Hey all, I am trying to get a variable to concatinate to a string then use that string as a command like this: newx = place + "[" + num + "]"; Where place = "ones" and num = "8".
So my line new line is: newx = ones[8]; This will make newx equal to the static string array "ones" in the "8" place. I can get the concatination to the string but it doesn't treat the string like a command. Thanks for the help! Don
Carl Trusiak
Sheriff
Joined: Jun 13, 2000
Posts: 3340
posted
0
Yes, all you did was assign the String value "ones[8]" to newx. You cannot use a String Object to represent a variable. If you want to assign the value in ones[8] to newx you have to use the variable name. If num is a String you'll have to convert it to an int first.
If places can hold other values besides "ones" you need to put this in a controll structure to determine which array to place it in.