How to do this using standard methods (without manual iteration through source string)?
PS: At final I want to get sorted characters of source string. I tried to use NSCharacterSet, but can’t find a method to convert character set to string (without iterating the set).
There is no built-in method for this, but it’s pretty easy to iterate over the characters of the string and build a new string without duplicates:
This results in the string
"adbc"(duplicates removed) and the sorted array of unique characters["a", "b", "c", "d"].