Returns a string by adding backslash escapes as necessary to protect any characters that would match as pattern metacharacters.
- iOS 4.0+
- macOS 10.7+
- tvOS 9.0+
- watchOS 2.0+
The escaped string.
Returns a string by adding backslash escapes as necessary to the given string, to escape any characters that would otherwise be treated as pattern metacharacters. You typically use this method to match on a particular string within a larger pattern.
For example, the string
"(N/A)" contains the pattern metacharacters
). The result of adding backslash escapes to this string is