A=0, B=1 ....
Let's say i have a String "ABCD"
How do i code it so that when i pass this string into a method, it'll process A as 0, B as 1, C as 2 and D as 3?
In other words, when "ABCD" is passed into the method, i want to operate on 0123, when ACDB, 0231 and so on...
(If it's possible, i would like to avoid using switch-case)
A-Z uppercase range from 10 to 35, independent of the Unicode specification. (from the Character class API)
String stuff = "ACDB";
for(int i=0; i<stuff.length();i++)
char c = stuff.charAt(i);
int value = Character.getNumericValue(c)-10;
System.out.println(c+" = "+value);
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center