2 Instruction Descriptions
2-524
NJ-series Instructions Reference Manual (W502)
MID
The MID instruction extracts a text string with the specified number of characters from the specified
character position.
The MID instruction extracts a text string with the number of characters specified by number of charac-
ters L from the source string In. The first character to extract is specified by first character P. A NULL
character is placed at the end of extraction result Out.
Instruction Name FB/FUN Graphic expression ST expression
MID Get String Any FUN Out:=MID(In, L, P);
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
P First char-
acter
First character to extract 1 to 1985
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
POK
Out OK
Function
(@)MID
EN ENO
In Out
L
P