Search – AMT Datasouth PAL User Manual
Page 173
167
search
search
Description
Searches for the first occurance of one string within another string.
Usage
AnyStr SearchStr
search
PostStr MatchStr PreStr
true
AnyStr SearchStr
search
AnyStr
false
AnyStr
String. Search to search.
SearchStr
String. String to locate within AnyStr.
PostStr
String. Characters from AnyStr which follow SearchStr.
PreStr
String. Character from AnyStr which precede SearchStr.
MatchStr
String. Characters from AnyStr which match the characters from SearchStr.
MatchStr will contain the same characters as SearchStr, but MatchStr will
exist as an entirely different string.
true
Boolean. Indicates that the interpreter found SearchStr within AnyStr.
false
Boolean. Indicates that the interpreter was unable to locate SearchStr within
AnyStr.
Comments
The interpreter will stop when it locates the first occurance of SearchStr within AnyStr. If the
interpreter locates SearchStr within AnyStr, the interpreter returns three new strings followed by
true. true informs the PAL procedure that a match was found. The three new strings contain the
characters before the matching characters, the matching characters themselves, and the characters
which follow the matching characters.
Since MatchStr contains the characters which matched SearchStr, MatchStr will contain the
same characters as SearchStr. However, MatchStr will exist in memory as an entirely different
string from SearchStr. Any subsequent modifications to either string will not affect the other
string.
If the interpreter cannot locate SearchStr within AnyStr, the interpreter returns AnyStr followed
by false. false informs the PAL procedure that a match was not found.