1

I'm trying to sort my array by group and then identifier fields, which works fine, until one of the strings contains a special character, for example Á or Ű.

Is there any kind of typescript or ng-2 specific method or sth to solve my problem?

Example sorting method:

private someSortingMethod(): void { this.sortable= this.sortable.sort((t1: SomeThing, t2: SomeThing): number => { if (t1.group < t2.group) return -1; if (t1.group > t2.group) return 1; if (t1.identifier < t2.identifier) return -1; if (t1.identifier > t2.identifier) return 1; return 0; }); } 

Thank you.

1
  • 1
    What is your input, what do you expect the output to be, and what is your actual output? What is the problem?
    – JB Nizet
    CommentedAug 21, 2017 at 16:46

1 Answer 1

1

There's a package on npm that does what you need:

var removeDiacritics = require('diacritics').remove; console.log(removeDiacritics("Iлtèrnåtïonɑlíƶatï߀ԉ")); // prints "Internationalizati0n" 

https://www.npmjs.com/package/diacritics

0

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.