---
title: "scanString(_:into:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/scanner/scanstring(_:into:)"
---

# scanString(_:into:)

Scans a given string, returning an equivalent string object by reference if a match is found.

## Declaration

```swift
func scanString(_ string: String, into result: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool
```

## Parameters

- `string`: The string for which to scan at the current scan location.
- `result`: Upon return, if the receiver contains a string equivalent to string at the current scan location, contains a string equivalent to string.

## Return Value

Return Value true if string matches the characters at the scan location, otherwise false.

## Discussion

Discussion If string is present at the current scan location, then the current scan location is advanced to after the string; otherwise the scan location does not change. Invoke this method with NULL as stringValue to simply scan past a given string.

## See Also

### Scanning Characters and Strings

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