How to check if a string contains a substring in Delphi?

后端 未结 1 949
无人共我
无人共我 2021-01-01 13:57
String content = \"Jane\";
String container = \'A.Sven,G.Jane,Jack\'; // This is the string which i need to be searched with string content

b

相关标签:
1条回答
  • 2021-01-01 14:26

    You can use the functions in StrUtils in Delphi

    uses
      StrUtils;
    ..
        if ContainsText('A.Sven,G.Jane,Jack', 'Jane') then 
        ...
    

    ContainsText returns true if the subtext is found, without case-sensitivity, in the given text

    In StrUtils you'll also find handy functions like StartsText, EndsText and ReplaceText

    0 讨论(0)
提交回复
热议问题