Posted By

freder on 09/16/10


Tagged

sort array String compare umlauts


Versions (?)

sort strings (that contain umlauts)


 / Published in: JavaScript
 

  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  

You need to login to post a comment.