subtracting
TypeScriptsubtracting(other: CharacterClass): CharacterClassSwift declarationfunc subtracting(_ other: CharacterClass) -> CharacterClassReturns a character class by subtracting the given class from this class.
struct · iOS 16.0+ · SDK 27.1
struct CharacterClassA class of characters that match in a regex. A character class can represent individual characters, a group of characters, the set of character that match some set of criteria, or a set algebraic combination of all of the above.
subtracting(other: CharacterClass): CharacterClassSwift declarationfunc subtracting(_ other: CharacterClass) -> CharacterClassReturns a character class by subtracting the given class from this class.
intersection(other: CharacterClass): CharacterClassSwift declarationfunc intersection(_ other: CharacterClass) -> CharacterClassReturns a character class from the intersection of this class and the given class.
static generalCategory(category: SDKHandle): CharacterClassSwift declarationstatic func generalCategory(_ category: Unicode.GeneralCategory) -> CharacterClassReturns a character class that matches any element with the given Unicode general category. For example, when passed `.uppercaseLetter`, this method is equivalent to `/\p{Uppercase_Letter}/` or `/\p{Lu}/`.
symmetricDifference(other: CharacterClass): CharacterClassSwift declarationfunc symmetricDifference(_ other: CharacterClass) -> CharacterClassReturns a character class matching elements in one or the other, but not both, of this class and the given class.
get regex(): SDKHandleSwift declarationvar regex: Regex<Substring> { get }The regular expression represented by this component.
union(other: CharacterClass): CharacterClassSwift declarationfunc union(_ other: CharacterClass) -> CharacterClassReturns a character class from the union of this class and the given class.
get inverted(): CharacterClassSwift declarationvar inverted: CharacterClass { get }A character class that matches any character that does not match this character class. For example, you can use the `inverted` property to create a character class that excludes a specific group of characters: let validCharacters = CharacterClass("a"..."z", .anyOf("-_")) let invalidCharacters = validCharacters.inverted let username = "user123" if username.contains(invalidCharacters) { print("Invalid username: '\(username)'") } // Prints "Invalid username: 'user123'"
No declarations were skipped in this snapshot.