String
struct String
Collection of all String Extensions.
Subspec: Extensions/StringExtension
-
Initialization using unicode name.
Declaration
Swift
public init(unicodeNameString: String)Parameters
unicodeNameStringUnicode name as string.
-
Returns a string if the optional string instance is not nil or empty, otherwise nil.
Declaration
Swift
public var whitespaceTrimmedAndNilIfEmpty: String? { get } -
Returns a string with leading and trailing whitespace trimmed.
Declaration
Swift
public var whitespaceTrimmed: String { get } -
New string, capitalizes first letter
Declaration
Swift
public func capitalizingFirstLetter() -> StringReturn Value
A string with the first letter capitalized
-
Mutates self to be the capitalized first letter version
Declaration
Swift
public mutating func capitalizeFirstLetter() -
Generates a localized string with the given parameters.
Declaration
Swift
public func localized(comment: String) -> StringParameters
commentComment for the localized string.
Return Value
String that is localized.
-
Removes the trailing line after the given token.
Declaration
Swift
public func removeTrailing(startWith token: String) -> StringParameters
tokenToken to search for.
Return Value
String of the removed trailing string. Includes removing the token.
-
Returns nil if empty, quite useful when “” means the same as nil to you.
Declaration
Swift
public var nilIfEmpty: String? { get } -
Is this string a valid URL?
Declaration
Swift
public var isValidUrl: Bool { get } -
Attempt to build a url with this string.
Declaration
Swift
public var url: URL? { get } -
Attempt to build a url string with this string, check for http because no one cares about that.
Declaration
Swift
public var urlString: String { get }
-
Determines if string is not empty and valid.
Declaration
Swift
public var isValidString: Bool { get } -
Determines if email is valid.
Declaration
Swift
public var isValidEmail: Bool { get } -
Determines is password is valid.
Declaration
Swift
public var isValidPassword: Bool { get } -
Determines if input string is not nil and valid.
Declaration
Swift
public static func isValidInput(_ input: String?) -> BoolParameters
inputOptional string.
Return Value
True, if not nil and valid, false otherwise.
-
Returns a URL string given a Twitter handle.
Declaration
Swift
public static func twitterURL(with username: String?) -> String?Parameters
usernameTwitter handle.
Return Value
URL string if handle given, nil otherwise.
-
Returns a URL string given a Facebook username.
Declaration
Swift
public static func facebookURL(with username: String?) -> String?Parameters
usernameFacebook username.
Return Value
URL string if handle given, nil otherwise.
-
Returns a URL string given an Instagram username.
Declaration
Swift
public static func instagramURL(with username: String?) -> String?Parameters
usernameInstagram username.
Return Value
URL string if handle given, nil otherwise.
-
Determines if the handles is valid.
Declaration
Swift
public var isValidHandle: Bool { get } -
Determine if the social link is valid.
Declaration
Swift
public var isValidSocialLink: Bool { get } -
Extracts username from given url string.
Declaration
Swift
public func extractedUserName() -> StringReturn Value
Username if included in path.
String Extension Reference