say for instance i have a string ie
"my dog did a Foo"
i want to pass each character into an array list and then perform operations according to certain indexes.
so i need to convert the characters to their decimal values in this case :-
"my dog did a Foo"
would translate to the following decimal representation:-
109 121 32 100 111 103 32 100 105 100 32 97 32 70 111 111
once this is done i need to send it to an array list and compile a string using the second number "121"
the last number "111" and another lets say "97" and will be doing calculations with those numbers.
so if these are parsed to an arraylist the index for the second number in this case "121" is index1, the index for "111" in this case would be the index equal to the strings length.(the last char) which means we need to determine this index before. and finally 97 which would be index 11.
how can i write a statement that will convert the string to decimal Char values, add each char to its own index in array list and then do calculations based on indexes? its been killing me for over a month!
the following code is terribly wrong but hopefully illustrates what i intend to do
if we use "i." to signify an index in the array.
k = 0;
private String lengthofstring = k;
while (k <= lengthofstring){
System.out.println(i.1+i.11 + "-" + i.lengthofstring);
k++
}
supposedly printing :-
218-111(or whichever is at the index equal to lengthofstring)
any help would be amazing
many thanks in advance for any help u can offer.
Stringclass gotcharAt(int ind)method?