+ 1

How to get individual chars from a single string

how to store '1' from ''1455"

19th Nov 2017, 3:57 AM
Debarghya Ghosh Dastidar
Debarghya Ghosh Dastidar - avatar
1 Antwort
+ 5
You can use charAt(index) or make a char array from the string and use the index to get the specific char. String s = "1455"; char ch = s.charAt(0); // ch = '1' or char[] chArr = s.toCharArray(); char ch = chArr[0]; https://docs.oracle.com/javase/7/docs/api/java/lang/String.html
19th Nov 2017, 4:06 AM
ChaoticDawg
ChaoticDawg - avatar