There is no simpler way. Unfortunately, even the method described in the question is too simple, at least if the portability is of any concern.
localeCompare , , ( JavaScript) . , , , , . , !
, , - elses, . , JavaScript, : Unicode, , , 'æ'.toUpperCase() Æ .
, , , ( ). , Ascii, , , ( Going Global JavaScript Globalize.js):
String.prototype.removeUmlauts = function () {
return this.replace(/Ä/g,'A').replace(/Ö/g,'O').replace(/Ü/g,'U');
};
function alphabetic(str1, str2) {
var a = str1.toUpperCase().removeUmlauts();
var b = str2.toUpperCase().removeUmlauts();
return a < b ? -1 : a > b ? 1 : 0;
}
, replace(/Æ/gi, 'Ae'), , , , . (, É E) , , , , , , É - Z. , , , , , , ( ).