PDA

View Full Version : String.Find help


WallyWonka
06-23-2009, 10:58 AM
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?

pww
06-23-2009, 01:29 PM
String.Find() returns -1 if nothing is found.

Use something like

if String.Find(....) > -1 then --string exists
Application.Exit();
end