Download CX-Programmer Operation Manual

Transcript
Appendix C
Function Descriptions
Standard Functions
Text String Functions
LEN: Detect String Length
• Function
Finds the length of a specified text string.
• Application
Return_value := LEN(string);
• Arguments and Return Values
Variable name
String
Data type
STRING
Return_value
INT
Description
Specifies the text string for
which to find the length.
Returns the size of the specified text string.
• Example
Variables
STRING Message
INT Result
Message
A
B
C
D
E
F
G
H
Result:=LEN(Message);
→ "8" is stored in Result variable.
LEFT: Extract Characters from Left
• Function
Extracts the specified number of characters from the left of the specified text string.
• Application
Return_value := LEFT(Source_string, Number_of_characters);
• Arguments and Return Values
Variable name
Source_string
Data type
STRING
Number_of_characters
INT, UINT
Return_value
STRING
Description
Specifies the text string from which to
extract characters.
Specifies the number of characters to
extract.
Returns the extracted characters.
• Example
Variables
STRING Message
STRING Result
Message
A
B
C
D
E
F
G
H
Result:=LEFT(Message,3);
→ "ABC" is stored in the Result variable.
RIGHT: Extract Characters from Right
• Function
Extracts the specified number of characters from the right of the specified text string.
• Application
Return_value := RIGHT(Source_string, Number_of_characters);
187