开发者

Locale dependent string sorting/comparison in JavaScript

开发者 https://www.devze.com 2023-03-31 04:20 出处:网络
Is there any way through which we can sort/compare string in JavaSciprt that are locale-dependent?开发者_运维百科 Like java provides us, \"java.text.Collator\" class.I think you\'re looking for locale

Is there any way through which we can sort/compare string in JavaSciprt that are locale-dependent?开发者_运维百科 Like java provides us, "java.text.Collator" class.


I think you're looking for localeCompare.

Try this for example:

'ä'.localeCompare('a'); // Returns 131 in Chrome
0

精彩评论

暂无评论...
验证码 换一张
取 消