please could you help me with comparing two strings with special characters in the same way as MySQL does it? For example this two strings should be equal: "Dražík" and "Drazik"
Asked
Active
Viewed 3,849 times
1
-
You can probably get some ideas [here](http://stackoverflow.com/q/1453171/1343161). – Keppil Aug 29 '12 at 06:49
3 Answers
3
Use a Collator . See Performing Locale-Independent Comparisons

Pierre
- 34,472
- 31
- 113
- 192
-
And since I'm using this comparison in equals method, do you know how to make hashcode for such a string? I mean how to get the same hash for both Dražík and Drazik. – dpelisek Aug 29 '12 at 07:09
-
1
Most probably getting the Edit Distance/ Levenshtein distance should resolve your issue. This is not an ideal solution but you may use it with significant success.

Chathuranga Chandrasekara
- 20,548
- 30
- 97
- 138
-1
You can simply use the s.compareTo(z) function where s,z are the string names. It returns the difference between the first unmatched characters in the two strings

Arghya Chakraborty
- 433
- 1
- 3
- 12