Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
A string encoding. For possible values, see
true if the receiver can be converted to
encoding without loss of information. Returns
false if characters would have to be changed or deleted in the process of changing encodings.
If you plan to actually convert a string, the
data methods return
nil on failure, so you can avoid the overhead of invoking this method yourself by simply trying to convert the string.