compare special characters like À with regular A

前端 未结 3 1351
北海茫月
北海茫月 2021-01-25 20:54

In some languages there are letters like À, I saw that for table view sections the native iOS put À under the same section as A.
I wan

3条回答
  •  余生分开走
    2021-01-25 21:19

    You can convert it first into regular alphabets and then compare.

    NSString *originalStr = @"À béautiful day";
    NSData *d = [originalStr dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
    NSString *converted = [[NSString alloc] initWithData:d encoding:NSASCIIStringEncoding];
    

提交回复
热议问题