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)
4 Answers
+ 2
or
String name = "James Clear";
int idx = name.indexOf(' ') +1;
char firstLetter = name.charAt( idx);
System.out.print(firstLetter);
+ 1
Dorsa , look at the code.
https://code.sololearn.com/c0l8peip2HfQ/?ref=app
0
Thanks a lot !!!
I didn‘t know about the split and it was really helpful🙏🏻
0
Thanks a lot🙏🏻🙏🏻🙏🏻