0

Java method

Hello, what method is there in Java that gives us, for example, the first letter of a string, for example, if the first letter of a string is a number, something should be done

9th Jan 2021, 7:53 AM
Am.Mr
Am.Mr - avatar
2 Answers
+ 3
CharAt(number) Takes a character from a string, the character number is specified in number
9th Jan 2021, 8:11 AM
Makar Mikhalchenko
Makar Mikhalchenko - avatar
+ 2
Use String str = "your string "; char c = str.charAt(0);
9th Jan 2021, 8:27 AM
Krish
Krish - avatar