2

I have some text imported from sqlite database and then I set that text to some button. Now, I have some text like München, or Stanković, or Kazalište. You get the point. User has to guess the right answer and I solved the issue when user insert lowercase word, and my word is with first letter capital. I just convert my word and his entered word to uppercase. But how to accept the answer even if user enter Munchen, or Stankovic or Kazaliste, without those special letters that I have in my database?

marjanbaz
  • 982
  • 3
  • 15
  • 33

3 Answers3

0

Try using collator.

Performing Locale-Independent Comparisons

Collation rules define the sort sequence of strings. These rules vary with locale, because various natural languages sort words differently. You can use the predefined collation rules provided by the Collator class to sort strings in a locale-independent manner.

Achintya Jha
  • 12,267
  • 2
  • 25
  • 38
0

I think you'll need to explicitly replace all the special characters with the acceptable characters. So, ü -> u and so on. Just as you have done by using toUpperCase which substitutes u with U.

Tom Carchrae
  • 5,916
  • 2
  • 32
  • 33
0
String expression ="š|ć|ü";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(inputStr);
if (matcher.matches()) 
{
//your code
}
Bhavesh Jethani
  • 3,903
  • 4
  • 21
  • 42