NSCharacterSet decomposableCharacterSet
+ (id)decomposableCharacterSet
Return Value of [NSCharacterSet decomposableCharacterSet]
A character set containing all individual Unicode characters that can also be represented as composed character sequences (such as for letters with accents), by the definition of “standard decomposition” in version 3.2 of the Unicode character encoding standard.
Discussion of [NSCharacterSet decomposableCharacterSet]
These characters include compatibility characters as well as pre-composed characters.
Note: This character set doesn’t currently include the Hangul characters defined in version 2.0 of the Unicode standard.
NSCharacterSet decomposableCharacterSet example.
NSString *inputString = @"Västerås ;; Swed en ";
NSLog(@"Input String %@",inputString);
inputString = [inputString lowercaseString]; // Lower case
inputString = [inputString stringByReplacingOccurrencesOfString:@" " withString:@""]; //Whitespace
inputString = [[inputString componentsSeparatedByCharactersInSet:[[NSCharacterSet letterCharacterSet] invertedSet]] componentsJoinedByString:@""]; //Punctuation
inputString = [[inputString componentsSeparatedByCharactersInSet:[NSCharacterSet decomposableCharacterSet]] componentsJoinedByString:@""]; // non-english characters
NSLog(@"Input String %@",inputString);
inputString = [inputString lowercaseString]; // Lower case
inputString = [inputString stringByReplacingOccurrencesOfString:@" " withString:@""]; //Whitespace
inputString = [[inputString componentsSeparatedByCharactersInSet:[[NSCharacterSet letterCharacterSet] invertedSet]] componentsJoinedByString:@""]; //Punctuation
inputString = [[inputString componentsSeparatedByCharactersInSet:[NSCharacterSet decomposableCharacterSet]] componentsJoinedByString:@""]; // non-english characters