String
extension String
-
Undocumented
Declaration
Swift
public var localized: String { get }
-
Returns the first extracted YouTube Id from the
String
. If there is none, this will be nil.Declaration
Swift
public var youtubeId: String? { get }
-
Returns the first URL found in the
String
. If there is none or the URL is invalid, this returns nil.Declaration
Swift
public var firstUrl: URL? { get }
-
Finds the first match given a regular expression pattern in the
String
.Declaration
Swift
public func firstMatchForRegEx(_ pattern: String) -> String?
Parameters
pattern
The regular expression pattern.
Return Value
The first match given a regular expression pattern in the
String
. If there is none, this is nil. -
Returns an
NSAttributedString
interpreting the HTML from theString
.Declaration
Swift
public var attributedHTMLString: NSAttributedString? { get }
-
Returns the String stripped of CSS.
Declaration
Swift
public var strippedCSS: String { get }
-
Returns the String stripped of HTML, CSS and NBSP.
Declaration
Swift
public var strippedHTML: String { get }
-
Returns true if the
String
is a valid URL along with scheme and host, otherwise it returns false.Declaration
Swift
public var isValidURL: Bool { get }
-
Returns true if the
String
is a valid email address, otherwise it returns false.Declaration
Swift
public var isValidEmail: Bool { get }
-
Returns true if the
String
is a valid phone number, otherwise it returns false.A valid phone number in this case is a
String
with no letters.Declaration
Swift
public var isValidPhoneNumber: Bool { get }
-
Returns true if the
String
is blank, otherwise it returns false.A blank string is considered either empty or just having whitespace or new lines.
Declaration
Swift
public var isBlank: Bool { get }
-
Create a string period based on the given date strings.
If both parameters or the startDate are invalid, this method will just throw an empty string. But if endDate is invalid this will instead used the word Onwards.
Note
This method used CheetahStringFormat for the format of the date.Declaration
Swift
public static func createPeriod(startDate: String, endDate: String, withFormat format: String = Date.CheetahStringFormat ) -> String
Parameters
startDate
The beginning of the period.
endDate
The end of the period.
Return Value
A string period.