Instance Property


Character set containing the characters the scanner ignores when looking for a scannable element.


var charactersToBeSkipped: CharacterSet? { get set }


Characters to be skipped are skipped prior to the scanner examining the target. For example, if a scanner ignores spaces and you send it a scanInt32(_:) message, it skips spaces until it finds a decimal digit or other character. While an element is being scanned, no characters are skipped. If you scan for something made of characters in the set to be skipped (for example, using scanInt32(_:) when the set of characters to be skipped is the decimal digits), the result is undefined.

The characters to be skipped are treated as single values. A scanner doesn’t apply its case sensitivity setting to these characters and doesn’t attempt to match composed character sequences with anything in the set of characters to be skipped (though it does match pre-composed characters individually). If you want to skip all vowels while scanning a string, for example, you can set the characters to be skipped to those in the string “AEIOUaeiou” (plus any accented variants with pre-composed characters).

The default set to skip is the whitespace and newline character set.

See Also

Configuring a Scanner

var scanLocation: Int

The character position at which the receiver will begin its next scanning operation.

var caseSensitive: Bool

Flag that indicates whether the receiver distinguishes case in the characters it scans.

var locale: Any?

The locale to use when scanning.