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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help for checking a condition

Status
Not open for further replies.

sanjna000

Programmer
Aug 1, 2003
132
GB
Hi,
I need to load the values from a file. in that i am using a string list to load the values from the imported file. I need to check whether there are any comments or empty rows in the string list. (The comments will be starting with a '!' mark and the empry row will be the '') . Does any one know how can i make the checking ?

Many thanks,
sanjna..
 
hi
This'll strip out the lines.

Code:
    for idx := strlist.count-1 downto 0 do
    begin
      if (strlist[idx]='') OR (strlist[idx][1] ='!')
        then strlist.delete(idx)
    end;

lou

 
oops, just one thing...

If by any chance an exception is raised because of the strlist[idx][1] on an empty string, then change it to this:-

for idx := strlist.count-1 downto 0 do
begin
if (strlist[idx]='') then strlist.delete(idx)
else
if (strlist[idx][1] ='!') then strlist.delete(idx)
end;

lou


 
Thank you so much for your help. I really appriciate it a lot!

Many Thanks
Sanjna :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top