I got just the fix for you. Was just trying to do the same thing. Needed to be able to create an array with an infinate number of variables. Here's what I came up with. Well, I was adding 2 variables at a time, so it may be a little different than your version.
String[] parts;
String x = "";
String var = "";
int i = 0;
//to add variables
if(x.contains("-"){
x+="-"+var;
}
else{
x+=""+var;
}
then to get them, u just use.
if(x.contains("-")){
parts = x.split("-");
while(i<parts.length){
var=parts[i];
i++;
}
}
else if (x!=""){
var = x;
}
Changing the variables is a whole other story. I'll let your gifted mind figure that out. I don't need that part yet.
*hint, you're going to have to loop and put together the whole String back together with the new variables. Hope this helped. Felt like this was a new way of looking at it.