Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you parse a string to a char?! 1

Status
Not open for further replies.

jcrapps

Programmer
Oct 26, 2001
94
US
I am obviously a crappy programmer because I do not know this... but How do you parse a string to be a char? I tried Char.parseChar(any string here), but it didn't work.
Please help me-
 
The problem is that a String can never be a char. A String is an array of chars so to be able to convert a String to a char doesn't make sense. It is very easy however to get the array of chars that make up a String. Example:
Code:
String string = "test";
char[] array = string.toCharArray();
You could also use
Code:
getChars
if there is a particular range of the String that you would like to convert.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top