If you want to match some part of the string without any fancy wildcards, as you point out in the comment to another answer, you can use a simple function, for example:
function FindMatchStr(Strings: TStrings; const SubStr: string): Integer; begin for Result := 0 to Strings.Count-1 do if ContainsStr(Strings[Result], SubStr) then exit; Result := -1; end;
If you want case insensitive, you can use this:
function FindMatchText(Strings: TStrings; const SubStr: string): Integer; begin for Result := 0 to Strings.Count-1 do if ContainsText(Strings[Result], SubStr) then exit; Result := -1; end;
ContainsStr and ContainsText defined in the StrUtils RTL StrUtils and follow the standard Str conventions to indicate case-sensitive comparisons and Text to indicate case-insensitivity.
source share