bitmapRepresentation
Returns a representation of the CharacterSet
in binary format.
var bitmapRepresentation: Data { get }
Returns a representation of the CharacterSet
in binary format.
var bitmapRepresentation: Data { get }
s10Foundation12CharacterSetV20bitmapRepresentation0A10Essentials4DataVvp
What are these?4F4TU
import Foundation
struct CharacterSet
A CharacterSet
represents a set of Unicode-compliant characters. Foundation types use CharacterSet
to group characters together for searching operations, so that they can find any of a particular set of characters during a search.
@frozen struct Data
init()
Initialize an empty instance.
init(bitmapRepresentation data: Data)
Initialize with a bitmap representation.
init(charactersIn range: ClosedRange<UnicodeScalar>)
Initialize with a closed range of integers.
init(charactersIn string: String)
Initialize with the characters in the given string.
init(charactersIn range: Range<UnicodeScalar>)
Initialize with a range of integers.
init?(contentsOfFile file: String)
Initialize with the contents of a file.
init(from decoder: any Decoder) throws
static var alphanumerics: CharacterSet { get }
Returns a character set containing the characters in Unicode General Categories L*, M*, and N*.
static var capitalizedLetters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category Lt.
static var controlCharacters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category Cc and Cf.
static var decimalDigits: CharacterSet { get }
Returns a character set containing the characters in the category of Decimal Numbers.
static var decomposables: CharacterSet { get }
Returns a character set containing individual Unicode characters that can also be represented as composed character sequences (such as for letters with accents), by the definition of “standard decomposition” in version 3.2 of the Unicode character encoding standard.
static var illegalCharacters: CharacterSet { get }
Returns a character set containing values in the category of Non-Characters or that have not yet been defined in version 3.2 of the Unicode standard.
static var letters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category L* & M*.
static var lowercaseLetters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category Ll.
static var newlines: CharacterSet { get }
Returns a character set containing the newline characters (U+000A ~ U+000D
, U+0085
, U+2028
, and U+2029
).
static var nonBaseCharacters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category M*.
static var punctuationCharacters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category P*.
static var symbols: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category S*.
static var uppercaseLetters: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category Lu and Lt.
static var urlFragmentAllowed: CharacterSet { get }
Returns the character set for characters allowed in a fragment URL component.
static var urlHostAllowed: CharacterSet { get }
Returns the character set for characters allowed in a host URL subcomponent.
static var urlPasswordAllowed: CharacterSet { get }
Returns the character set for characters allowed in a password URL subcomponent.
static var urlPathAllowed: CharacterSet { get }
Returns the character set for characters allowed in a path URL component.
static var urlQueryAllowed: CharacterSet { get }
Returns the character set for characters allowed in a query URL component.
static var urlUserAllowed: CharacterSet { get }
Returns the character set for characters allowed in a user URL subcomponent.
static var whitespaces: CharacterSet { get }
Returns a character set containing the characters in Unicode General Category Zs and CHARACTER TABULATION (U+0009)
.
static var whitespacesAndNewlines: CharacterSet { get }
Returns a character set containing characters in Unicode General Category Z*, U+000A ~ U+000D
, and U+0085
.
var debugDescription: String { get }
var description: String { get }
var inverted: CharacterSet { get }
Returns an inverted copy of the receiver.
static func == (lhs: CharacterSet, rhs: CharacterSet) -> Bool
Returns true if the two CharacterSet
s are equal.
func contains(_ member: UnicodeScalar) -> Bool
Test for membership of a particular UnicodeScalar
in the CharacterSet
.
func encode(to encoder: any Encoder) throws
mutating func formIntersection(_ other: CharacterSet)
Sets the value to an intersection of the CharacterSet
with another CharacterSet
.
mutating func formSymmetricDifference(_ other: CharacterSet)
Sets the value to an exclusive or of the CharacterSet
with another CharacterSet
.
mutating func formUnion(_ other: CharacterSet)
Sets the value to a union of the CharacterSet
with another CharacterSet
.
func hasMember(inPlane plane: UInt8) -> Bool
Returns true if the CharacterSet
has a member in the specified plane.
func hash(into hasher: inout Hasher)
@discardableResult mutating func insert(_ character: UnicodeScalar) -> (inserted: Bool, memberAfterInsert: UnicodeScalar)
Insert a UnicodeScalar
representation of a character into the CharacterSet
.
mutating func insert(charactersIn range: ClosedRange<UnicodeScalar>)
Insert a closed range of integer values in the CharacterSet
.
mutating func insert(charactersIn string: String)
Insert the values from the specified string into the CharacterSet
.
mutating func insert(charactersIn range: Range<UnicodeScalar>)
Insert a range of integer values in the CharacterSet
.
func intersection(_ other: CharacterSet) -> CharacterSet
Returns an intersection of the CharacterSet
with another CharacterSet
.
mutating func invert()
Invert the contents of the CharacterSet
.
func isSuperset(of other: CharacterSet) -> Bool
Returns true if self
is a superset of other
.
@discardableResult mutating func remove(_ character: UnicodeScalar) -> UnicodeScalar?
Remove a UnicodeScalar
representation of a character from the CharacterSet
.
mutating func remove(charactersIn range: ClosedRange<UnicodeScalar>)
Remove a closed range of integer values from the CharacterSet
.
mutating func remove(charactersIn string: String)
Remove the values from the specified string from the CharacterSet
.
mutating func remove(charactersIn range: Range<UnicodeScalar>)
Remove a range of integer values from the CharacterSet
.
mutating func subtract(_ other: CharacterSet)
Sets the value to a CharacterSet
created by removing elements in other
from self
.
func subtracting(_ other: CharacterSet) -> CharacterSet
Returns a CharacterSet
created by removing elements in other
from self
.
func symmetricDifference(_ other: CharacterSet) -> CharacterSet
Returns an exclusive or of the CharacterSet
with another CharacterSet
.
func union(_ other: CharacterSet) -> CharacterSet
Returns a union of the CharacterSet
with another CharacterSet
.
@discardableResult mutating func update(with character: UnicodeScalar) -> UnicodeScalar?
Insert a UnicodeScalar
representation of a character into the CharacterSet
.
typealias ReferenceType = NSCharacterSet