canBeConverted(to:)
Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.
Declaration
func canBeConverted(to encoding: UInt) -> BoolParameters
- encoding:
A string encoding. For possible values, see Nsstringencoding.
Return Value
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.
Discussion
If you plan to actually convert a string, the dataUsingEncoding:... methods return nil on failure, so you can avoid the overhead of invoking this method yourself by simply trying to convert the string.