I was wondering how exactly one would convert a string of non-alphanumeric symbols into a string array. For example, what would be the code that takes the string
"@%$!#& (&$#^"
as an input, and converts it into a string array
{"@", "%", etc}
I was wondering how exactly one would convert a string of non-alphanumeric symbols into a string array. For example, what would be the code that takes the string
"@%$!#& (&$#^"
as an input, and converts it into a string array
{"@", "%", etc}
Create a String
array of the length of string..
int size = theString.length();
String[] asStringArray = new String[size];
then step through that array/String
adding chars from the String
with charAt()
for (int i=0; i<size; i++){
asStringArray[i] = ""+theString.charAt(i);
}
Other option is substring()
asStringArray[i] = theString.substring(i,i+1);