Search For...

Results 1 to 5 of 5

Thread: Search For...

  1. #1
    XAcem Guest

    Default Search For...

    I Am Tring To Write A Script That Will OPen A Certian Text File,<BR>Search For A String And Then Return A Value Of True Of False. Now I Wrote The Script To Open And Read The File But I Am Not Sure How To Search For The String. I Know How To Use The Replace Method To REPLACE Things But Not How To Just Search For Somthing. So This Is A Call To Anyone Who Could Help Me Or Give Me Suggestions. <BR><BR>THanks In Advacne,<BR>XAcem<BR><BR>This Is The Code:<BR>&#060;%<BR>Function CheckFile(FilePath,File)<BR> Const OpenFileForReading = 1 <BR> Set FSO=Server.CreateObject("Scripting.FileSystemObjec t")<BR> Set File = FSO.GetFile(FilePath & "/" & File)<BR> Set TextStream = File.OpenAsTextStream(OpenFileForReading)<BR> Do While Not TextStream.AtEndOfStream<BR> CheckFile = CheckFile & TextStream.ReadLine & NewLine<BR> Loop<BR> TextStream.Close<BR>End Function<BR>%&#062;<BR>&#060;%<BR>FilePath = "C:/inetpub/Fingertips/ftv2.0pro"<BR>File = "test.txt"<BR><BR>%&#062;<BR>This Is What This Script Returned:&#060;%=CheckFile(FilePath,File)%&#062;

  2. #2
    BAHEK Guest

    Default RE: Search For...

    Search one string within another you can with function InStr<BR>

  3. #3
    XAcem Guest

    Default Not Exactly

    That Was Not Exactly What I Was Looking For. I Already Found That. For Example I Want TO OPen Up A ASP Page Ane It For A Certain String And Then Return Turn Or False. SO The Call For Help I Still Out There.<BR><BR>Thanks IN Advance,<BR>Matt

  4. #4
    BAHEK Guest

    Default RE: Not Exactly

    That&#039s exactly what you need to use - function InStr.<BR>It will tell you if the string that you looking for exist or not.

  5. #5
    KPW Guest

    Default RE: Not Exactly

    BAHEK is right.<BR><BR>If InStr(1,TextToSearch,TextToFind,vbTextCompare) &#062; 0 then<BR>&#039 string was found<BR>Else<BR>&#039 string was not found<BR>End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts