
Reference Manual
IVC-2D
©
SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
247
Appendix
A.2
String Operators
Symbol Meaning
+
Concatenation
=
Comparision. Returns 1 if both strings are identical.
Asc(char)
Returns the ASCII code for the specified character. For exam-
ple
asc(‘A’)
returns the value 65.
Chr(number)
Returns the character for the specified ASCII code. For exam-
ple
chr(66)
returns
’B’
.
Sub(str, index)
The character at position
index
. Note that the first character
in the string has index
0
.
Negative values will count the positions from the end, for
example
-1
will return the last character.
Sub(str, start,
stop)
A substring with the characters at positions from
start
to
stop-1
. Note that the first character in the string has index
0
.
If
start
is empty, all characters from position 0 to
stop
are
returned.
If
stop
is empty, all characters from position
start
to the
end of the string are returned.
For example
sub(‘Hello World’, 0, 5)
returns
‘Hello’
and
sub(‘Hello World’, 6, 11)
returns
‘World’
.
Len(str)
The number of characters in the string.
Eval(str)
Evaluates the string as if it were an expression. For example
eval('1+2+3')
returns 6.
Str(number)
A string representation of the number. For example
Str(1.23)
returns the string
'1.23'
Repr(number)
A string representation of the number that can be re-evaluated
to its original value. For example
Repr(1.23)
returns the
string
'1.000'
A.3
Time stamps
It is possible to access the current time from a step program by using a string operator.
Two operators are available, one that returns the UTC time and one that returns the time
and date as a string. For the string operators to return the correct time, a time server IP
address need to be set up (see Time server in Appendix B). If the Emulator is used the
time from the computer will be used and the supplied timezone will not be used.
Symbol Meaning
time(timeZone)
Returns the local time in seconds, UTC time with offset. time-
Zone is the local offset from UTC time in hours.
timestr(timeZone,
format)
Returns the local time and date as a string, timeZone is the
local offset from UTC time in hours. Three formats are possible:
Format value
Example
0 2008-10-02
14:27:42
1 02.10.2008
14:27:42
2 10/02/2008
02:27:42
PM