sort strings (that contain umlauts)


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function compare_strings(a, b) {
  2. a = a.toLowerCase();
  3. a = a.replace("ä", "ae");
  4. a = a.replace("ö", "oe");
  5. a = a.replace("ü", "ue");
  6. a = a.replace("ß", "ss");
  7.  
  8. b = b.toLowerCase();
  9. b = b.replace("ä", "ae");
  10. b = b.replace("ö", "oe");
  11. b = b.replace("ü", "ue");
  12. b = b.replace("ß", "ss");
  13.  
  14. return (a == b)? 0: (a > b)? 1: -1;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.