AnsiStartsStr
Belongs to : FunctionDescription
The AnsiStartsStr function looks for a Needle string at the start of a Haystack string, returning true if it finds it. Otherwise false.
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 |
var haystack : AnsiString; begin haystack := 'The cat sat on the mat'; // Note that AnsiStartsStr is case sensitive if AnsiStartsStr('THE cat', haystack) then ShowMessage('''THE cat'' starts the sentence') else ShowMessage('''THE cat'' does not start the sentence'); if AnsiStartsStr('The cat', haystack) then ShowMessage('''The cat'' starts the sentence') else ShowMessage('''The cat'' does not start the sentence'); end; Show full unit code 'THE cat' does not start the sentence 'The cat' starts the sentence |