slaugier
7 years agoOccasional Contributor
Trouble to use aqString.Find in a if condition
Hello
I have a text file, I want to copy it to a new file.
I want to modify it by using aqString.Replace with some substrings found by aqString.Find.
But aqString.Find seems to find nothing.
At the end, I have the exact copy of my file.
Do you have any advice?
count = 1;
while (foundFiles.HasNext()) { aqFile.Create(fHTMLFile); aFile=foundFiles.Next(); bFile = aqFile.OpenTextFile(aFile.Path, aqFile.faReadWrite, aqFile.ctUTF8); bFile.Cursor = 0; while(! bFile.IsEndOfFile()){ bLine = bFile.ReadLine(); if (aqString.Find(bLine, "data")) { aqString.Replace(bLine,"data", "data" + count) } if (aqString.Find(bLine, "idChart")) { aqString.Replace(bLine,"idChart", "idChart" + count) } if (aqString.Find(bLine, "chart")) { aqString.Replace(bLine,"chart", "chart" + count) } aqFile.WriteToTextFile(fHTMLFile, bLine, aqFile.ctUTF8); } bFile.Close(); count = count+1 ; }
Thank you !
Thank you! It helped me a lot!
And I had to correct this way to solve everything :
if (aqString.Find(bLine, "data") != -1) { bLine = aqString.Replace(bLine,"data", "data" + count) } if (aqString.Find(bLine, "idChart") != -1) { bLine = aqString.Replace(bLine,"idChart", "idChart" + count) } if (aqString.Find(bLine, "chart") != -1) { bLine = aqString.Replace(bLine,"chart", "chart" + count) }