Can someone tell me how to extract single caharacter from a a string? for example: I have an String array of 9 digit numbers entered at the command line. I want to extract each of the 9 numbers from he string in each cell of the array and place them into another array singly. command line entry String args[] in main = 123456789,987654321... first command line number 123456789 goes into an int array [0] = 1 [1] = 2 [2] = 3... Thanks, Brian Turner
Michael Morris
Ranch Hand
Joined: Jan 30, 2002
Posts: 3451
posted
0
Hi Brian, The method String.charAt(int index) should do what you want. Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
You can also convert the String into a char array using the toCharArray() method.