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
精彩评论