문제

Both FindNoCase and Find funcions are returning 0 values for all cases. I'm working on Coldfusion 9.

<cfoutput>#Find("aaInternationalbb", "International")#</cfoutput>       ->o/p:0
<cfoutput>#Find("aalbb", "International")#</cfoutput>                   ->o/p:0
<cfoutput>#FindNoCase("aaInternationalbb", "International")#</cfoutput> ->o/p:0
<cfoutput>#FindNoCase("aalbb", "International")#</cfoutput>             ->o/p:0

Please let me know how to make this work. Thanks in advance

도움이 되었습니까?

해결책

This is not working because you have given the parameters in wrong order. The syntax for each of find() and findNoCase() are

 FindNoCase(substring, string [, start ])

 Find(substring, string [, start ])

So you have to try like:

  <cfoutput>#Find( "International","aaInternationalbb")#</cfoutput>       
  <cfoutput>#Find( "International","aalbb")#</cfoutput>                   
  <cfoutput>#FindNoCase("International","aaInternationalbb" )#</cfoutput> 
  <cfoutput>#FindNoCase("International","aalbb")#</cfoutput>

This will give output as: 3 0 3 0

다른 팁

findNoCase and Find will expect ( stringtosearch, stringtosearchfrom [,start])

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top