I am having problem with NSString
compare. The localizedCaseInsensitiveCompare
: or any other compare
: method in NSString
is returning wrong result to me with extended ascii character set. for example below code, after comparison, noString
should be after the enString1
.
any idea, how can I solve the problem?
NSString * noString = @"ÅåÆæØøab"; // ASCII values, 197, 229, 198, 230, 216, 248, 97, 98
NSString * enString1 = @"fbcd";
NSString * enString2 = @"bbcd";
NSString * enString3 = @"zbcd";
NSLog(@"%i", [enString1 localizedCaseInsensitiveCompare:enString2]); // 1
NSLog(@"%i", [enString1 localizedStandardCompare:noString]); // 1, should be -1
NSLog(@"%i", [enString1 localizedCaseInsensitiveCompare:noString]); // 1, should be -1
"aa" compareTo "aå" is returning Ascending. Thats right. But,
"aa" compareTo "aæ" is returning Descending, why? same for "aø" too.