How can I make the user's inputed string starts with capital letter ?? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 4

How can I make the user's inputed string starts with capital letter ??

I want to know how to change the first letter of the inputed string to capital and making all the charracters capital . Thanks for your help :)

25th Apr 2017, 12:20 PM
Fady Sayoud
Fady Sayoud - avatar
1 ответ
+ 15
To capitalize the first letter of a string you could use (inStr is the string the user input). String str = inStr.substring(0, 1).toUpperCase() + inStr.substring(1); To capitalize the whole string use: String str = inStr.toUpperCase();
25th Apr 2017, 12:36 PM
Tashi N
Tashi N - avatar