I've been trying to get each character from every String by column but I only got the first characters of every string, I want to get every character by column from every string.
For example:
I have three strings from ArrayList of Strings:
- chi
- llo
- ut
What I want to happen must be like this, after getting each character by column from strings:
- clu
- hlt
- io
So long, my current source code only gets the first characters of first two string which is 'cl', Here's my current source code:
List<String> New_Strings = new ArrayList<String>();
int Column_Place = 0;
for (String temp_str : Strings) {
try{ //For StringIndexOutOfBoundsException (handle last String)
if(Column_Place >= temp_str.length()){
Current_Character = temp_str.charAt(Column_Place);
New_Strings.add(Character.toString(Current_Character));
break;
}else if (Column_Place < temp_str.length()){
Current_Character = temp_str.charAt(Column_Place);
New_Strings.add(Character.toString(Current_Character));
}
}catch(Exception e){
continue;
}
Column_Place++;
}