开发者

Locale dependent string sorting/comparison in JavaScript

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜