String
@frozen
public extension String
-
Checks if a string is made of only digits.
Declaration
Swift
var isDigits: Bool { get } -
Checks if the String contains any digit.
Declaration
Swift
var containsDigit: Bool { get } -
Checks if the string starts with a capital letter.
Declaration
Swift
var isCapitalized: Bool { get } -
Checks if a string is made of only lowercase charaters.
Declaration
Swift
var isLowercased: Bool { get } -
The string contains at least one lowecase character.
Declaration
Swift
var containsLowercase: Bool { get } -
Checks if a string is made of only uppercase charaters.
Declaration
Swift
var isUppercased: Bool { get } -
The string contains at least one uppercase character.
Declaration
Swift
var containsUppercase: Bool { get } -
Returns a
Stringof random numbers.Declaration
Swift
static func randomDigits(length: Int) -> StringParameters
lengthThe desired length of the string.
Return Value
A string long as the desired length made of random digits.
-
Returns a string
Declaration
Swift
static func random( length: Int, includeLowercaseLetters: Bool = true, includeCapitalLetters: Bool = true, includeDigits: Bool = true, additionalCharacters: String = "" ) -> StringParameters
lengthThe desired length of the string.
includeLowercaseLettersIf true, includes
abcdefghijklmnopqrstuvwxyz
in allowed characters.includeCapitalLettersIf true, includes
ABCDEFGHIJKLMNOPQRSTUVWXYZ
in allowed characters.includeDigitsIf true, includes
0123456789
in allowed characters.additionalCharactersA list of aditional characters to include.
Return Value
A
Stringas long as the desired length, made of the allowed characters. If no character type is allowed, and no additionalCharacters are passed, returns an empty string. -
Clears the string. Sets it to an empty string.
Declaration
Swift
mutating func clear()
View on GitHub
String Extension Reference