答案 0 :(得分:0)
有很多方法可以解决这个问题。可能使用正则表达式是最好的,虽然我无法得到一个简单的例子。或者,您可以在找到它们时替换字符串中的出现次数,并继续查看,直到没有剩余。
你必须做更多的工作才能进行错误检查/验证等,但这是一个基本的例子。 Here's the full example
<cfset Base64Header = "base64,">
<cfset Base64Ending = '"'>
<cfset ResultsArray =[]>
<cfset ContinueSearching = true>
<cfloop condition = " ContinueSearching eq true "><cfoutput>
<cfset StartingIndex = find( Base64Header, SearchText)>
<cfif StartingIndex eq 0>
<cfset ContinueSearching = false>
<cfcontinue/>
</cfif>
<cfset EndingIndex = find( Base64Ending , SearchText, StartingIndex )>
<cfset FullOccurrence = mid(#SearchText#, (#StartingIndex#), ((#EndingIndex#)-#StartingIndex#))>
<cfset LocalOccurrence = mid(#SearchText#, (#StartingIndex#+7), ((#EndingIndex#-7)-#StartingIndex#))>
<cfset ArrayAppend(ResultsArray, #LocalOccurrence#)>
<cfset SearchText = replace(SearchText, FullOccurrence, "")>
<cfset StartingIndex = 0>
</cfoutput></cfloop>
<cfdump var = "#ResultsArray#">