procedure TForm1.W3Button14Click(Sender: TObject);
var haystack : String;
begin
haystack := 'The cat sat on the mat';
// Note that AnsiContainsStr is case sensitive
if haystack.Contains('THE')
then WriteLn('''THE'' was found')
else WriteLn('''THE'' was not found');
if haystack.Contains('the')
then WriteLn('''the'' was found')
else WriteLn('''the'' was not found');
// Note that AnsiStartsStr is case sensitive
if haystack.StartsWith('THE cat')
then WriteLn('''THE cat'' starts the sentence')
else WriteLn('''THE cat'' does not start the sentence');
if haystack.StartsWith('The cat')
then WriteLn('''The cat'' starts the sentence')
else WriteLn('''The cat'' does not start the sentence');
// Note that AnsiEndsStr is case sensitive
if haystack.EndsWith('the MAT')
then WriteLn('''the MAT'' ends the sentence')
else WriteLn('''the MAT'' does not end the sentence');
if haystack.EndsWith('the mat')
then WriteLn('''the mat'' ends the sentence')
else WriteLn('''the mat'' does not end the sentence');
haystack := "Atletico;Cruzeiro;Flamengo;Corinthians,Gremio";
WriteLn( haystack.EqualsText('Flamengo') ); // false
WriteLn( haystack.EqualsText('Atletico;Cruzeiro;Flamengo;Corinthians,Gremio') ); // true
end;
|