使用 Coldfusion 检查字符串是否包含列表元素
Check string contains a list element using Coldfusion
我知道listcontains()
是用来检查列表是否包含指定的字符串。有什么方法可以使用 Coldfusion 检查字符串是否包含列表元素?
我认为您需要的是 ListFindNoCase() 或 ListFind(),具体取决于显而易见的情况。
像这样:
<cfloop from="1" to="#ListLen(yourList)#" index="elemementNumber">
<cfif yourString contains ListGetAt(elemementNumber)>
yes
<cfelse>
no
</cfif>
</cfloop>
我知道listcontains()
是用来检查列表是否包含指定的字符串。有什么方法可以使用 Coldfusion 检查字符串是否包含列表元素?
我认为您需要的是 ListFindNoCase() 或 ListFind(),具体取决于显而易见的情况。
像这样:
<cfloop from="1" to="#ListLen(yourList)#" index="elemementNumber">
<cfif yourString contains ListGetAt(elemementNumber)>
yes
<cfelse>
no
</cfif>
</cfloop>