0

Here is the edited code for the SearchView and working fine:

    val searchText = query!!.toLowerCase(Locale.getDefault())
                if (searchText.isNotEmpty()){
                    dbList.forEach {
                        val txtKrString = Normalizer.normalize(it.txtKr, Normalizer.Form.NFD)
                            .replace("[^\\p{ASCII}]".toRegex(), "")
                        val txtFrString = Normalizer.normalize(it.txtFr, Normalizer.Form.NFD)
                            .replace("[^\\p{ASCII}]".toRegex(), "")
                        if (txtKrString.toLowerCase(Locale.getDefault()).contains(searchText)){
                            tempdbList.add(it)
                        }else if (txtFrString.toLowerCase(Locale.getDefault()).contains(searchText)){
                            tempdbList.add(it)
                        }
                    }
                    this@Main.recyclerv.adapter!!.notifyDataSetChanged()
                }
Hagat
  • 1
  • 1
  • 2
    Before comparing you can normalize your query/data strings to unicode normal form D, and then remove the diacritic combining chars. https://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette – laalto Jan 19 '22 at 12:12
  • Unfortunately, it didn't work for me but thanks – Hagat Jan 19 '22 at 12:46
  • Maybe you can update your question to show how you tried to implement that solution so we can see if we can spot the problem. – Tenfour04 Jan 19 '22 at 13:15
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jan 30 '22 at 02:43

0 Answers0