16 right$ function, 17 mid$ function, 18 val% function – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual
Page 94

7Ć6
7.16
RIGHT$ Function
Format:
RIGHT$(string,str_length)
where:
string can be a string variable or expression.
str_length is the number of characters to take from the right side
of the string (expression) in parameter 1.
The function returns a substring that is equal to
`strĆlength'(parameter 2) of the rightĆmost characters of the string or
string expression (parameter 1):
SUB_STRING$ = RIGHT$(`ABCDEFG',4) (SUB_STRING
ąąă has the value DEFG)
STR1$ = '12345'
SUB_STRINGS$ = RIGHT$(STR1$ + 'ABC',6)
ă (SUB_STRING$ has the value 345ABC)
7.17
MID$ Function
Format:
MID$(string, start, end)
where:
string can be a string variable or expression.
start is the starting character position of the substring.
end is the ending character position of the substring.
The function returns a substring from within another string. The
three parameters are, respectively, the string to operate on, the
starting character position, and the ending character position. The
substring is then taken from those two inclusive positions:
SUB_STRING$ = MID$(`ABCDEFG',2,3) (SUB_STRING$
has the value BC)ą ąĂ
STRING$ = BIGLONGSTRING"
SUB_STRING$ = MID$(STRING$,3,7) (SUB_STRING$ has
the value GLONG)ą ąăĂ
7.18
VAL% Function
Format:
VAL%(string)
where:
string can be a string variable or expression.
The function returns the integer value of a string in an integer format.
If the string is not in an integer format, the returned value will be zero
and an error is logged:
STR_VAL% = VAL%(`123' + `74') (STR_VAL% has the
value 12374)ăăăăăăăăăă