Data Sheet
dScript
dScript User Manual v2.15
String expressions
The only operator used with strings is + and should be read as concatenation rather than
addition as it joins two strings together to make one string.
S1 = “This is ”
S2 = “compiler!”
S3 = S1 + “the dScript ” + S2
results in S3 containing “This is the dScript compiler”
Numeric variables in string expressions
Numeric variables can be included in string expressions.
X = 24
Y = 31
S1 = “Variable X contains ” + X
results in S1 containing “Variable X contains 24”
S1 = “Look at this -> “ + X + Y
results in S1 containing “Look at this -> 2431“ , not “Look at this -> 55“
The + in string expressions is concatenation, not addition.
Decimal, hexadecimal and binary formatting
By default variables are placed in strings in decimal format as above. They can also be inserted
in hexadecimal or binary formats. To do this place the control character in curly braces
immediately before the variable.
S1 = “X in hex format is “ + {H} X
results in “X in hex format is 18“
or
S1 = “X in binary format is “ + {B} X
results in “X in binary format is 11000“
and you can use decimal
S1 = “X in decimal format is “ + {D} X
results in “X in decimal format is 24“
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
21