0

I'm looking for a function that would compare 2 strings, but treat 'similar' letters as equals. So:

myFunction(cake, ćäke); // returns true
// but
myFunction(cake, ćäek); // returns false

I was thinking of making such a function myself, and my idea was to make it check the strings letter by letter, and for each letter it would have an array of 'similar' ones, and if 2 letters are in the same array, they are treated as the same.

But, is there a simpler way? Does JavaScript (or jQuery) have something like that built in? Or, am I being silly and is my algorithm inferior to another one? If so, could someone point me in the right direction?

admdrew
  • 3,790
  • 4
  • 27
  • 39
Bluefire
  • 13,519
  • 24
  • 74
  • 118
  • here : http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript – njzk2 May 05 '14 at 19:01
  • 1
    [Remove accents in strings](http://stackoverflow.com/questions/990904/javascript-remove-accents-in-strings) and then do your regular compare – kei May 05 '14 at 19:05
  • @njzk2 No. I have simply suggested that as a potential algorithm. – Bluefire May 05 '14 at 19:09

0 Answers0