CRE Programmer's Guide

String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
8-11
Stcpma
Return Value
The Stcpm functions return the length of the first matching substring, if a match was
found. If a match was not found, the functions returns -1.
Considerations
The ends of str and pat are defined by the location of a zero (null) byte.
You can use a backslash (\) as an escape character if you need to match a special
character (?,
*
, or +).
Note that match must be a pointer to a character pointer.
Example
STRING .s[0:17] := ["xxFORTUNE 500",0];
STRING .pattern[0:4] := ["FO?T",0];
STRING .match;
INT i;
! i get 4.
! @match gets @s[2]
i := RTL_Stcpm_(s, pattern, @match);
Stcpma
The Stcpma functions scan a string to determine whether it starts with a substring that
matches a specified pattern. These functions are not available in the native CRE
library.
str
is a pointer to the string to scan.
INT PROC RTL_Stcpma_( str, pat );
STRING .str; ! in
STRING .pat; ! in TNS only
INT PROC RTL_StcpmaX_( str, pat );
STRING .EXT str; ! in
STRING .EXT pat; ! in TNS only