如何检查字符串是否包含 Delphi 中的子字符串?
How to check if a string contains a substring in Delphi?
String content = "Jane";
String container = 'A.Sven,G.Jane,Jack'; // This is the string which i need to be searched with string content
boolean containerContainsContent = StringUtils.containsIgnoreCase(container, content); // I used to write like this in java
我是 Delphi 的新手。 Delphi中是否有contains
命令或执行相同操作的任何其他命令?
您可以在Delphi
中使用StrUtils
中的函数
uses
StrUtils;
..
if ContainsText('A.Sven,G.Jane,Jack', 'Jane') then
...
ContainsText
returns true
如果在给定文本中找到子文本,不区分大小写
在 StrUtils
中,您还可以找到方便的函数,例如 StartsText
、EndsText
和 ReplaceText
String content = "Jane";
String container = 'A.Sven,G.Jane,Jack'; // This is the string which i need to be searched with string content
boolean containerContainsContent = StringUtils.containsIgnoreCase(container, content); // I used to write like this in java
我是 Delphi 的新手。 Delphi中是否有contains
命令或执行相同操作的任何其他命令?
您可以在Delphi
中使用StrUtils
中的函数
uses
StrUtils;
..
if ContainsText('A.Sven,G.Jane,Jack', 'Jane') then
...
ContainsText
returns true
如果在给定文本中找到子文本,不区分大小写
在 StrUtils
中,您还可以找到方便的函数,例如 StartsText
、EndsText
和 ReplaceText