---
title: "scanUpToCharacters(from:into:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/scanner/scanuptocharacters(from:into:)"
---

# 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

```swift
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

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

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

- [scanCharacters(from:into:)](foundation/scanner/scancharacters(from:into:).md)
- [scanString(_:into:)](foundation/scanner/scanstring(_:into:).md)
- [scanUpTo(_:into:)](foundation/scanner/scanupto(_:into:).md)
