Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the "Contains" Delphi string helper case sensitive?

Delphi XE3 introduced a Contains string helper function, but the help-file/wiki does not state whether it is case sensitive or not?

like image 648
Kobus Smit Avatar asked Sep 28 '22 23:09

Kobus Smit


1 Answers

Yes it is case sensitive.

Quick test:

ShowMessage('TEST'.Contains('t').ToString(TUseBoolStrs.True));

returns False


Use ToLowerInvariant or ToUpperInvariant to compare case insensitive:

ShowMessage('TEST'.ToLowerInvariant.Contains('t').ToString(TUseBoolStrs.True));
like image 154
Kobus Smit Avatar answered Oct 19 '22 04:10

Kobus Smit