草庐IT

localizedStandardCompare

全部标签

ios - "localizedStandardCompare"取决于 iOS 设备的语言偏好

NSSortDescriptor*sortDescriptor=[[NSSortDescriptoralloc]initWithKey:@"name"ascending:YESselector:@selector(localizedStandardCompare:)];[fetchRequestsetSortDescriptors:[NSArrayarrayWithObjects:sortDescriptor,nil]];我正在开发一个包含姓名列表的应用程序,其中所有姓名均使用Íslenska(冰岛语)语言。如果在设置中为应用程序选择的语言是Íslenska(冰岛语),则上述代码可以正

ios - 使用 UILocalizedIndexedCollat​​ion 和 localizedStandardCompare 对字符串进行排序 : method

使用这个(内存排序)时排序顺序有区别吗[[UILocalizedIndexedCollationcurrentCollation]sortedArrayFromArray:namesArraycollationStringSelector:@selector(sortName)]和这个(用于CoreData排序)fetchRequest.sortDescriptors=[NSArrayarrayWithObject:[NSSortDescriptorsortDescriptorWithKey:@"name"ascending:YESselector:@selector(localize

ios - 用于本地化的字符串比较

NSString的localizedCaseInsensitiveCompare:和localizedStandardCompare:方法有什么区别?我阅读了引用资料,但不知道该使用哪一个。 最佳答案 localizedCaseInsensitiveCompare:等同于:[aStringcompare:otherStringoptions:NSCaseInsensitiveSearchrange:NSMakeRange(0,aString.length)locale:[NSLocalecurrentLocale]];localiz