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...
Thomas Henry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
Concatenation
Syntax:
stringvar = variable1 + variable2
Command Availability:
Available on all microcontrollers
Explanation:
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.
Example:
timevariable = 999
stringvar = "Time = " + timevariable ' Returns Time = 999
Last edit: Anobium 2014-03-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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...
Thomas Henry
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.
Last edit: Anobium 2014-03-30
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.
Last edit: Anobium 2014-03-31