AnsiMatchStr
Belongs to : FunctionDescription
The AnsiMatchStr function checks to see if any of the strings in StringList exactly match the Source string.
If any match, true is found, otherwise false is returned.
The string list can be specified as a square bracket delimited list, as in the example, or as an array of strings.
It is a Case sensitive command.
Example code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
var source : AnsiString; begin source := 'Henry'; // The string to match // Note that AnsiMatchStr is case sensitive // We use a hard coded constant string array if AnsiMatchStr(source, ['BRIAN', 'JIM', 'HENRY']) then ShowMessage('First match was successful') else ShowMessage('First match was not successful'); // Note that arrays start at 0 if AnsiMatchStr(source, ['Brian', 'Jim', 'Henry']) then ShowMessage('Second match was successful') else ShowMessage('Second match was not successful'); end; Show full unit code First match was not successful Second match was successful |