Skip to content

Commit

Permalink
Update String+Casing.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay-luassat committed Jun 25, 2024
1 parent 495e623 commit 8615946
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Foundation

/// An extension to the `String` class to add functionality for converting strings to title case.
extension String {

/// Converts a string from camelCase or PascalCase to a human-readable title case format.
///
/// This method inserts spaces before uppercase characters and capitalizes the first letter
Expand All @@ -27,8 +26,9 @@ extension String {
of: "([A-Z])",
with: " $1",
options: .regularExpression,
range: range(of: self))
.trimmingCharacters(in: .whitespacesAndNewlines)
.capitalized
range: range(of: self)
)
.trimmingCharacters(in: .whitespacesAndNewlines)
.capitalized
}
}

0 comments on commit 8615946

Please sign in to comment.