Answered
Conditional loop
Hi,
I have what I thought was a simple conditional loop to find each occurence of a serach string within a variable. Basically trying to find the occurence, note it, then move on. If findnocase can't find an occurence, it should return 0, ending the loop:
<cfset findvar = 1>
<Cfloop condition="findvar GT 0">
<cfoutput>
<cfset findvar = #findnocase("#form.searchterm#","#searchfile#",#findvar#)#>
Position in file: #findvar#<br>
</cfoutput>
</cfloop>
This doesn't work at all. Just spins forever and never returns a result.
...help? Thanks!
I have what I thought was a simple conditional loop to find each occurence of a serach string within a variable. Basically trying to find the occurence, note it, then move on. If findnocase can't find an occurence, it should return 0, ending the loop:
<cfset findvar = 1>
<Cfloop condition="findvar GT 0">
<cfoutput>
<cfset findvar = #findnocase("#form.searchterm#","#searchfile#",#findvar#)#>
Position in file: #findvar#<br>
</cfoutput>
</cfloop>
This doesn't work at all. Just spins forever and never returns a result.
...help? Thanks!
