I am trying to replace Umlauts in both directions. I managed to replace Umlauts in one direction. For example, a string has an ö (Björn) than oe (Bjoern) should be written. This is the code I used:
umlauts = {"ä":"ae", "ü":"ue", "ö":"oe"}
replaceUmlaute = function(s) {
return s.replace(/[äöüß]/g, function($0) {
return umlauts[$0] })
}
How could I change the code in order to make it dynamic so the umlaut would be replaced in both ways Björn -> Bjoern or Bjoern->Björn. I need a function that takes a string and checks the umlauts. If its an ö then switch to oe and if its an oe then switch to ö. Thanks!