The following code sort of works, but fixes the number of elements in String[]. Is there a way to make a String[] add the number of elements needed dynamically?
private static StringBuilder names = new StringBuilder();
...
public String[] getNames() {
int start = 0;
int end = 0;
int i = 0;
String[] nameArray = {"","","",""};
while (-1 != end) {
end = names.indexOf(TAB, start);
nameArray[i++] = names.substring(start, end);
start = ++end; // The next name is after the TAB
}
return nameArray;
}