Re: Character type problem
Two easy ways come to mind - you can convert a digit character to its numeric value with Character.digit(char), or you can convert a String number to a numeric value using Integer.parseInt(str, radix). So to get an array of ints from the String, you could do this:
Code:
String tempString = "17896";
// use Character.digit(..)
char tempArray[] = tempString.toCharArray();
int[] valueArray = new int[tempArray.length];
for (int i=0; i < tempArray.length; i++) {
valueArray[i] = Character.digit(tempArray[i], 10);
}
// alternatively, use Integer.parseInt(..)
int[] valueArray = new int[tempString.length()];
for (int i=0; i < tempString.length(); i++) {
valueArray[i] = Integer.parseInt(tempString.substring(i, i+1));
}
The problem is never how to get new, innovative thoughts into your mind, but how to get old ones out!
D. Hock