I would like to convert the occurence of some special characters with a chainable function, to work something like this:
>>> "Den här ån gör gott".normalizor().toUpperCase();
"DEN HAR AN GOR GOTT"
I'm only interested to convert certain characters:
å >> a
ä >> a
ö >> o
Any help to get me in the right direction here would be much appreciated!
Pure javascript or use of any library doesn't matter.
normalize
seems like a better method name:
"Den här ån gör gott".normalize().toUpperCase();
String.prototype.normalize = function() {
return this.replace(/[åä]/g, 'a')
.replace(/[ö]/g, 'o');
}