2 Instruction Descriptions
2-270
NJ-series Instructions Reference Manual (W502)
STRING_TO_** (Text String-to-
Integer Conversion Group)
These instructions convert text strings to integers.
* The valid range depends on the data type of Out. Refer to Function for details.
These instructions convert a text string, In, to an integer.
Basically, the text string in In must consist only of numbers 0 to 9. The following exceptions are possi-
ble.
• If the first character in In is a single minus sign (−) or a single plus sign (+), it is processed as the sign.
• Any blank characters at the beginning of In are ignored.
• Any blank characters between an initial minus sign (−) or plus sign (+) and a number are ignored.
• Any single underbars (‘_’) at any location are ignored.
• An error occurs if there are two or more consecutive underbars (‘_’) at any location.
• An error occurs if there are any underbars (‘_’) at the beginning or end.
• An error occurs if there are any underbars (‘_’) between the minus signs (‘−’) or plus sign (‘+’) and the
number at the beginning.
The name of the instruction is determined by the data type of conversion result Out. For example, if Out
is the DINT data type, the instruction is STRING_TO_DINT.
Instruction Name FB/FUN Graphic expression ST expression
STRING_TO_** Text String-to-Inte-
ger Conversion
Group
FUN Out:=STRING_TO_** (In);
"**" must be an integer data
type.
Variables
Name Meaning I/O Description Valid range Unit Default
In Data to
convert
Input Data to convert *
--- ''
Out Conver-
sion result
Output Conversion result 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
Out OKOKOKOKOKOKOKOK
Function
"**" must be an integer data type.
(@)STRING_TO_**
EN ENO
In Out