How to check whether Cyrillic in the line?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
6 views
How to check for Cyrillic?
For example, if the string is Cyrillic, it will display an error, and if all Latin, there will be no error?
How to do a similar test in java?
by | 6 views

2 Answers

0 like 0 dislike
Use the test strings with a regular expression.
In your case you need to look no forbidden characters, but rather to check that the string contains only allowed characters.
\rhttps://ru.stackoverflow.com/questions/569779/%D0%...
by
0 like 0 dislike
String s = "Test"; cyrillic boolean = s.chars() .mapToObj(UnicodeBlock::of) .anyMatch(b -> b.equals(UnicodeBlock.CYRILLIC));
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
35,458 users