如何在Delphi中检查字符串是否包含子字符串?

编程入门 行业动态 更新时间:2024-10-15 10:20:56
本文介绍了如何在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); //我以前是在java

这样写的,我是 Delphi 的新手。在 Delphi 中是否存在个包含的命令或执行相同操作的任何其他命令?

I am new to Delphi. Is there a contains command in Delphi or any other command which performs the same operation?

推荐答案

您可以在 Delphi的 StrUtils 中使用函数

You can use the functions in StrUtils in Delphi

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

ContainsText 如果找到子文本,则返回 true ,不区分大小写,在给定的文本中

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

在 StrUtils 中,您还会发现方便的函数,例如 StartsText , EndsText 和 ReplaceText

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

更多推荐

如何在Delphi中检查字符串是否包含子字符串?

本文发布于:2023-11-29 16:10:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646900.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   如何在   Delphi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!