Answer the question
In order to leave comments, you need to log in
How to check if Cyrillic is present in a string?
How to check for Cyrillic?
For example, if the line contains Cyrillic, then it will display an error, but if everything is Latin, then there will be no error?
How to do a similar check in java?
Answer the question
In order to leave comments, you need to log in
String s = "Тест";
boolean cyrillic = s.chars()
.mapToObj(UnicodeBlock::of)
.anyMatch(b -> b.equals(UnicodeBlock.CYRILLIC));
Use regular expression string validation.
In your case, you need to look not for forbidden characters, but on the contrary, check that the string contains only allowed characters.
https://ru.stackoverflow.com/questions/569779/%D0%...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question