So i have an array of strings. Each index contains a string like "abc" "fnsb" "feros". I want to pass in this array of strings through a for loop that can get each character's ASCII value of ALL the strings listed above and possibly store each string's character's ASCII value in another array. For example, if my array of strings has
mystrings[0] = hi
mystrings[1] = hello
mystrings[2] = farewell
I want it to take the ASCII values of "h" and "i" and store it in an newarray[0]
, then take the ASCII values of "h","e","l","l","o" and store it into newarray[1]
, and ETC.
Note: Above is a bunch of pseudocode. Here is what I actually have:
String[] mystrings= new String[100];
double [] newarray = new double[100];
for (int x=0; x<100; x++){
char character = mystrings[x].charAt(x);
int ascii = (int) character;
newarray[x] = ascii;
System.out.println(newarray[x]);
}
Another note: There are indeed multiple strings stored in each index of the mystrings array. It's just in another part of my code that I don't want to share. So please assume that the "mystrings" array is properly filled with various strings. Thank you!