How to compare Chinese strings in English environment?

牧云@^-^@ 提交于 2019-12-25 08:49:57

问题


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:


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



来源:https://stackoverflow.com/questions/6787570/how-to-compare-chinese-strings-in-english-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!