var decomp="noël";
var precomp="noël";
console.log(decomp.split(""));
console.log(precomp.split(""));
console.log(decomp.localeCompare(precomp));
Prints:
["n", "o", "e", "̈", "l"]
["n", "o", "ë", "l"]
0
Browser support for this varies, The Intl.Collator interface is currently only supported Chrome (maybe also in Opera? Idk).
Note: In Chrome when comparing (e.g. sorting) a lot of strings String.prototype.localeCompare is much slower than using a pre-composed Intl.Collator instance (because internally localeCompare creates a new collator for each call). Using Intl.Collator rediced startup time of my http://greattuneplayer.jit.su/ immensely. node.js currently has no support for Intl.*. It probably will be a compile time option for 0.12.
E.g.:
Prints: Browser support for this varies, The Intl.Collator interface is currently only supported Chrome (maybe also in Opera? Idk).Note: In Chrome when comparing (e.g. sorting) a lot of strings String.prototype.localeCompare is much slower than using a pre-composed Intl.Collator instance (because internally localeCompare creates a new collator for each call). Using Intl.Collator rediced startup time of my http://greattuneplayer.jit.su/ immensely. node.js currently has no support for Intl.*. It probably will be a compile time option for 0.12.