[Solved] How to split an string array element by whitespace, and forming two new arrays?


As you mentioned the split-function can handle this.

String[] types = new String[columnNameType.length];
String[] names = new String[columnNameType.length];

for(int i = 0 ; i< columnNameType.length; ++i){
   names[i] = columnNameType[i].split(" ")[0];
   types[i] = columnNameType[i].split(" ")[1];
}

iterate your array and split every element on its own.

1

solved How to split an string array element by whitespace, and forming two new arrays?