Dread_99 Dread_99 - 2 months ago 13
Java Question

How to convert a char array to a string array

How do you convert a char array to a string array? Or better yet, can you take a string and convert it to a string array that contains each character of the string?

Edit: thanks @Emiam! Used his code as a temp array then used another array to get rid of the extra space and it works perfectly:

String[] tempStrings = Ext.split("");
String[] mStrings = new String[Ext.length()];

for (int i = 0; i < Ext.length(); i++)
mStrings[i] = tempStrings[i + 1];

Answer

Or better yet, can you take a string and convert it to a string array that contains each character of the string?

I think this can be done by splitting the string at "". Like this:

String [] myarray = mystring.split("");