Is there a way to convert a String variable of the type "X" to a character ?
String state = "X";
char c_state = convertToChar(state);
How do I do this ?
You could do:
char c_state = state.charAt(0);
You could also convert it into a char array as follows, which could be quite useful if the String contained more than 1 character.
char[] charArray = state.toCharArray();
charAt gets optimised.)