String
extension String: LHSStringType, LHSURLStringType
-
A string identifical to
self
if not an empty string,nil
otherwise.See also
Optional.nilIfEmpty
Declaration
Swift
var nilIfEmpty: String? { get }
-
The length of the current string.
Declaration
Swift
var length: Int { get }
-
An
NSRange
encompassing all ofself
.Declaration
Swift
var range: NSRange { get }
-
Returns a
Range<String.Index>
equivalent to the providedNSRange
forself
.Declaration
Swift
@available(*, deprecated, message: "Now in the Swift Standard Library. Use `Range(_:in:﹚` instead.") func toRange(_ range: NSRange) -> Range<String.Index>
-
Trims all characters from the string in the specified
CharacterSet
.Declaration
Swift
mutating func trim(_ characterSet: CharacterSet)
-
URL encode the current string.
Declaration
Swift
mutating func URLEncode()
-
Undocumented
Declaration
Swift
mutating func replaceSpacesWithDashes()
-
Undocumented
Declaration
Swift
mutating func replaceCapitalsWithUnderscores()
-
A copy of
self
with the first letter lowercased.Declaration
Swift
var stringByLowercasingFirstLetter: String { get }
-
A copy of
self
with the first letter uppercased.Declaration
Swift
var stringByUppercasingFirstLetter: String { get }
-
A URL encoded copy of the current
String
.Declaration
Swift
var URLEncodedString: String? { get }
-
A copy of the current
String
with all spaces replaced with dashes.Declaration
Swift
var stringByReplacingSpacesWithDashes: String { get }
-
Undocumented
Declaration
Swift
func stringByConverting(toNamingFormat naming: VariableNamingFormat) -> String
-
Undocumented
Declaration
Swift
mutating func convert(toNamingFormat naming: VariableNamingFormat)
-
Undocumented
Declaration
Swift
func isComposedOf(charactersInSet characterSet: CharacterSet) -> Bool