How to compare Chinese strings in English environm

2019-09-01 06:02发布

I'm trying to compare Chinese strings with NSString - (NSComparisonResult)localizedStandardCompare:(NSString *)string method.

It works correctly if the system language is set to Chinese. But in English language environment, the strings is compared by something like unicode number. How can I compare strings with Chinese style in English environment?

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-01 06:43

Use - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range locale:(id)locale instead.

查看更多
登录 后发表回答