String
public extension String
-
Undocumented
Declaration
Swift
enum RegularExpressionPattern
-
Returns a new string made by removing the provided character from the leading of the string.
Declaration
Swift
func leadingTrimmed(_ character: Character) -> String
Parameters
character
The leading character to remove.
-
Returns a new string made by removing whitespaces and newlines from both ends of the receiver.
Declaration
Swift
func trimmed() -> String
-
Returns a new string made by removing whitespaces from both ends of the receiver.
Declaration
Swift
func whitespacesTrimmed() -> String
-
An
NSRange
that represents the full range of the string.Declaration
Swift
var fullNSRange: NSRange { get }
-
Returns a substring with the given
NSRange
, ornil
if the range can’t be converted.Declaration
Swift
func substring(with nsRange: NSRange) -> String?
-
Returns a range equivalent to the given
NSRange
, ornil
if the range can’t be converted.Declaration
Swift
func range(from nsRange: NSRange) -> Range<Index>?
-
Check if the string is an email address.
Declaration
Swift
var isEmail: Bool { get }
-
Replacing regular expression matches with template string. Could use
self.replacingOccurrences(of: pattern, with: template, options: .regularExpression)
Declaration
Swift
func replacingMatches( of pattern: String, options: NSRegularExpression.Options = [], matchingOptions: NSRegularExpression.MatchingOptions = [], with template: String ) throws -> String
-
Returns matched strings of a regular expression pattern.
Declaration
Swift
func matchedStrings( of pattern: String, options: NSRegularExpression.Options = [], matchingOptions: NSRegularExpression.MatchingOptions = [] ) -> [String]
-
Undocumented
Declaration
Swift
func firstMatchedString(of pattern: String, options: NSRegularExpression.Options = [], matchingOptions: NSRegularExpression.MatchingOptions = []) -> String?
-
Returns captured groups of a regular expression pattern for provided match index.
Declaration
Swift
func capturedGroups( of pattern: String, options: NSRegularExpression.Options = [], matchingOptions: NSRegularExpression.MatchingOptions = [], matchIndex: Int = 0 ) -> [String]
-
Returns percentage strings.
Declaration
Swift
func percentageStrings() -> [String]
-
Returns a new string by removing leading and trailing white-space from a string, replacing sequences of whitespace characters by a single space, and returns the resulting string.
Declaration
Swift
func whitespacesNormalized() throws -> String