I need to treat 9 kinds of language in a list below.
For words in these languages I need to use tolowercase()
.
and I know I need to use Locale(country, language)
as a parameter of the function.
Then, do I have to use specific locale for each language, or is there simpler way to do this?
You can construct a Locale
from an ISO 639 language code:
Locale russian = new Locale("RU");
There are nice default locales for you to use, for example:
Locale english = Locale.ENGLISH;
Locale french = Locale.FRENCH;
Locale german = Locale.GERMAN;
Locale italian = Locale.ITALIAN;
Then just use String#toLowerCase()
with the locale:
String lower = str.toLowerCase(someLocale);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With