Contents

scanUpToCharacters(from:into:)

Scans the string until a character from a given character set is encountered, accumulating characters into a string that’s returned by reference.

Declaration

func scanUpToCharacters(from set: CharacterSet, into result: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool

Parameters

  • set:

    The set of characters up to which to scan.

  • result:

    Upon return, contains the characters scanned.

Return Value

true if the receiver scanned any characters, otherwise false.

If the only scanned characters are in the charactersToBeSkipped character set (which is the whitespace and newline character set by default), then returns false.

Discussion

Invoke this method with NULL as stringValue to simply scan up to a given set of characters.

If no characters in stopSet are present in the scanner’s source string, the remainder of the source string is put into stringValue, the receiver’s scanLocation is advanced to the end of the source string, and the method returns true.

See Also

Scanning Characters and Strings