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; 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
posted 15 years ago
Yes, all you did was assign the String value "ones" to newx. You cannot use a String Object to represent a variable. If you want to assign the value in ones 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.