2 Instruction Descriptions
2-522
NJ-series Instructions Reference Manual (W502)
LEFT and RIGHT
These instructions extract a text string with the specified number of characters.
These instructions extract a text string with the number of characters specified by number of characters
L from the source string In. A NULL character is placed at the end of extraction result Out.
z LEFT
Extracts characters from the left (beginning) of In.
LEFT: Extracts characters from the left (beginning) of the text string.
RIGHT: Extracts characters from the right (end) of the text string.
Instruction Name FB/FUN Graphic expression ST expression
LEFT Get String Left FUN Out:=LEFT(In, L);
RIGHT Get String Right FUN Out:=RIGHT(In, L);
Variables
Name Meaning I/O Description Valid range Unit Default
In Source
string
Input
Text string from which to
extract characters
Depends on data type.
---
''
L Number of
characters
Number of characters to
extract
0 to 1985 1
Out Extraction
result
Output Extracted text string Depends on data type.
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In OK
LOK
Out OK
Function
(@)LEFT
EN ENO
In Out
L
(@)RIGHT
EN ENO
In Out
L