Ignoring diacritic characters when comparing words with special characters (é, è, …)

前端 未结 8 1588
梦如初夏
梦如初夏 2021-02-05 18:08

I have a list with some Belgian cities with diacritic characters: (Liège, Quiévrain, Franière, etc.) and I would like to transform these special characters to compare with a lis

8条回答
  •  遇见更好的自我
    2021-02-05 18:42

    This is the simplest solution I've found so far and it works perfectly in our applications.

    Normalizer.normalize(string, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); 
    

    But I don't know if the Normalizer is available on the Android platform.

提交回复
热议问题