To the keepers of the new Help File:
Under the heading of String operations, you might want to list the concatenation operator (plus) as an option.
I ended up using string concatenation a fair amount in the Sine and Cosine routines I posted a little earlier. I wasn't sure if it was in the language, but I just went ahead and tried it, and there it was! And it works as expected.
There really are lots of Easter eggs in GC Basic...
Another learning. I wonder what the constraints are.
I have added the following to the Help File. I will publish to the web next week.
stringvar = variable1 + variable2
Available on all microcontrollers
The method join two variables into another variable.
This method does not change the existing strings, but returns a new string containing the text of the joined variables.
Concatenation joins the elements of a specified values using the specified separator between each variable.
timevariable = 999
stringvar = "Time = " + timevariable ' Returns Time = 999
So the variables don't have to be string variables?
How does that work?
999 could be contained in a word or int which will use two bytes but 999 converted to a string requires three bytes. So is 999 converted to a string before being combined into a concatenated string variable?
Both variables need to be strings.
StringVariable = str ( 999 ) + " works" ' works.
StringVariable = str ( bytevariable ) + " works" ' works.
StringVariable = stringvariable + " works" ' works.
I will update help file to clarify.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.