daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let umlautMap = {
  2.   'u00dc': 'UE',
  3.   'u00c4': 'AE',
  4.   'u00d6': 'OE',
  5.   'u00fc': 'ue',
  6.   'u00e4': 'ae',
  7.   'u00f6': 'oe',
  8.   'u00df': 'ss',
  9. }
  10.  
  11. function replaceUmlaute(str) {
  12.   return str
  13.     .replace(/[u00dc|u00c4|u00d6][a-z]/g, (a) => {
  14.       var big = umlautMap[a.slice(0, 1)];
  15.       return big.charAt(0) + big.charAt(1).toLowerCase() + a.slice(1);
  16.     })
  17.     .replace(new RegExp('['+Object.keys(umlautMap).join('|')+']',"g"),
  18.       (a) => umlautMap[a]
  19.     );
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top