Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007
    Posts
    28

    String.Find help

    I need help with this code:

    hosts = TextFile.ReadToString(_SystemFolder .. "\\drivers\\etc\\hosts");
    is_there = String.Find("# Start of entries inserted by Spybot - Search & Destroy", "hosts", 1, false);

    if is_there then
    Application.Exit(0);
    end

    I want the installer to read the windows hosts file for the line "# Start of entries inserted by Spybot - Search & Destroy" and if that line exists to exit the application. Problem is, this code isn't working, I think the problem is the 'if is_there then' part. Any ideas?

  2. #2
    Join Date
    Jun 2005
    Posts
    470
    String.Find() returns -1 if nothing is found.

    Use something like
    Code:
    if String.Find(....) > -1 then	--string exists
    	Application.Exit();
    end

Posting Permissions

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