字符串是否包含子字符串的布尔值 [英] Boolean for whether a string contains a substring

查看:99
本文介绍了字符串是否包含子字符串的布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个文本变量$$string. 如何写一个布尔值来检查$$string是否包含文本$$substring?

Suppose I have a text variable $$string. How can I write a boolean to check whether $$string contains the text $$substring?

例如如果$$ string为"foobar"而$$ substring为"oo",则结果应为True,如果$$ string为"foo"而$$ substring为"bar"则结果应为False.

推荐答案

对于这样的问题,我偏爱PatternCount函数:

For a problem like this I'm partial to the PatternCount function:

 PatternCount($$string ; $$substring)

然后应返回false = 0或true> =1.您可以按以下方式将true强制为1:

You should then get back false = 0 or true >= 1. You can force true to 1 as follows:

 PatternCount($$string ; $$substring) > 0

此处的功能定义: http://fmhelp.filemaker.com/fmphelp_10/en/html/func_ref3.33.73.html

这篇关于字符串是否包含子字符串的布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆