equals() and contains() methods for char sequences ignoring difference between Greek-Latin characters
Not something try-hard. Useful for simple searches in applications. For example the string θα πάω για καφέ
contains the string kafe
.
Letters with Greek diacritics are considered equal to the Latin corresponding letters.
In other words all these are equal: υ
, ύ
, ϋ
, ΰ
, u
. Dipthongs are also taken in consideration.
The string θα φάω ψάρι
is equal to tha faw psari
.
The ignorance happens in both directions, meaning η πέtra
contains peτρα
. Take a look to Tester.java
to see other cases.
The algorithm uses the naive approach of string searching. In terms of performance, the algorithm is not close to JDK's String#contains method.
JDK's version uses the String#indexOf method which is intrinsic.
That said, it is recommended to use the ordinary s1.contains(s2)
(or equals
) before doing GreeklishUtils.contains(s1, s2)
since s1.contains(s2)
runs super fast.
If you find a bug or something wrong with it, let me know.