0

How can I have the character after the space?

for example I have the name : James Clear I want to have the character C, and the the problem is that if I have different names, how can I find the first character at family names?(The character after the space)

6th May 2022, 7:56 AM
Dorsa
4 Réponses
+ 2
or String name = "James Clear"; int idx = name.indexOf(' ') +1; char firstLetter = name.charAt( idx); System.out.print(firstLetter);
6th May 2022, 4:40 PM
zemiak
6th May 2022, 8:03 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Thanks a lot !!! I didn‘t know about the split and it was really helpful🙏🏻
6th May 2022, 11:43 AM
Dorsa
0
Thanks a lot🙏🏻🙏🏻🙏🏻
6th May 2022, 4:41 PM
Dorsa