Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is It Possible To Search For A Word In A Text File Using CFFile Tag? 1

Status
Not open for further replies.

Bikzit

Programmer
Mar 24, 2001
9
0
0
AE
Is It Possible To Search For A Word In A Text File Using CFFile Tag?

With regards. <CFBikzit Text=&quot;Hi There&quot;>
 
Just read your text file into a variable with <cffile>, then use the find() or findNoCase() functions to find the text your searching on. The <cffile> tag won't do the search by itself though.

Hope this helps,
GJ
 
Use the combination of tag <cffile>
and function <Find, FindNoCase, or FindOneOf>.


<CFFILE ACTION=&quot;Read&quot;
FILE=&quot;c:\web\message.txt&quot;
VARIABLE=&quot;Message&quot;>

<CFSET FoundIt = Find(&quot;Hello&quot;, Message, 1)>
or
<CFSET FoundIt = FindNoCase(&quot;Hello&quot;, Message, 1)>
or
<CFSET FoundIt = FindOneOf(&quot;Hello&quot;, Message, 1)>

<cfif Foundit GT &quot;0&quot;>
Hello was found.
<cfelse>
Hello was not found
</cfif>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top