For a poor man\'s implementation of near-collation-correct sorting on the client side I need a JavaScript function that does efficient single character rep
I've solved it another way, if you like.
Here I used two arrays where searchChars containing which will be replaced and replaceChars containing desired characters.
var text = "your input string";
var searchChars = ['Å','Ä','å','Ö','ö']; // add more charecter.
var replaceChars = ['A','A','a','O','o']; // exact same index to searchChars.
var index;
for (var i = 0; i < text.length; i++) {
if( $.inArray(text[i], searchChars) >-1 ){ // $.inArray() is from jquery.
index = searchChars.indexOf(text[i]);
text = text.slice(0, i) + replaceChars[index] + text.slice(i+1,text.length);
}
}