| Author |
how to convert from string("a") to char..
|
Eung maeng
Ranch Hand
Joined: Feb 10, 2002
Posts: 68
|
|
Hi, Does anyone explain to me how to convert from string("Y") to char? THANKS
|
 |
John Lockheart
Ranch Hand
Joined: Oct 13, 2006
Posts: 115
|
|
String y = "Y"; char y_char = y.charAt(0); And if the string is bigger than 1 letter you can do the same thing with a loop or break up the string and send it into a character array with the following: String y = "hello"; char[] array = y.toCharArray(); array = {'h', 'e', 'l', 'l', 'o'}
|
 |
Kaydell Leavitt
Ranch Hand
Joined: Nov 18, 2006
Posts: 679
|
|
I plan to use the following method to convert String to char: This code doesn't throw an exception, but it doesn't print the null characters either. Is this OK? Kaydell
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: how to convert from string("a") to char..
|
|
|