4-5 Macros
4-21
STRCMP(W),
STRICMP(W)
String Comparison
Applicable versions System Version 6.6 or higher
Format
STRCMP(S1,S2) STRICMP(S1,S2) --- ASCII code
STRCMPW(S1,S2) STRICMPW(S1,S2) --- Unicode
Function
Compares the string.
STRCMP(W) Case sensitive
STRICMP(W) Not case sensitive
Return Value
0: Agree
-1: Disagree. Character code S1 is smaller than character code S2.
1: Disagree. Character code S1 is greater than character code S2.
Example
STRCPY($W0, "ABC"); 'Set ABC to $W0 to $W1.
$W10= STRCMP($W0, "DEF"); 'Compare ABC and DEF. Character code
A, 0 x 41 < Character code D, 0 x 44. Thus the return value , -1, is stored in
$W0.
STRLEFT(W) Extracts the specified number of characters from leftmost characters
of a string
Applicable versions System Version 6.6 or higher
Format
STRLEFT(D,S,n), --- ASCII code
STRLEFTW(D,S,n) --- Unicode
Function Stores n characters from the left of the string S to D.
Return Value None
Example STRLEFT($W0,"ABCDEFG",3);
'Extract 3 characters (ABC) from the leftmost string and store ABC in $W0
and $W1.
STRLEN(W) Gets string length
Applicable versions System Version 6.6 or higher
Format
STRLEN(S) --- ASCII code
STRLENW(S) --- Unicode
Function Returns the length of the string S (The number of bytes of S).
Return Value String Length (The number of bytes of S).
Example
STRCPY($W0, "ABC");
$W10 = STRLEN($W0);
‘Set 3 to '$W10
STRLTRIM(W) Deletes the leftmost spaces of a string
Applicable versions System Version 6.6 or higher
Format
STRLTRIM(D,S) --- ASCII code
STRLTRIMW(D,S) --- Unicode
Function Deletes the leftmost space of the string S to enter it to D.
Return Value None
Example
STRLTRIM($W0, " ABC");
’Store ABC in $W0 to $W1.