sside
10-18-2004, 01:34 PM
Hello everybody
I have a string from which i want to filter some words. This is the code i use;
------------------------------------------------------------------------
strString = TextFile.ReadToString("Data\\2.txt");
tblFilters = {};
tblFilters[1] = "item1";
tblFilters[2] = "item2";
tblFilters[3] = "itme3";
resRepString = String.Replace(strString, tblFilters[1], "", false);
resRepString = String.Replace(resRepString, tblFilters[2], "", false);
resRepString = String.Replace(resRepString, tblFilters[3], "", false);
TextFile.WriteFromString("Data\\3.txt", resRepString, false);
------------------------------------------------------------------------
As the filter list grows so will grow the String.Replace procedure.
My question is this; how can i use the for loop here in order to make the script more flexible?
Any idea is appreciated.
Thank you
Sside
I have a string from which i want to filter some words. This is the code i use;
------------------------------------------------------------------------
strString = TextFile.ReadToString("Data\\2.txt");
tblFilters = {};
tblFilters[1] = "item1";
tblFilters[2] = "item2";
tblFilters[3] = "itme3";
resRepString = String.Replace(strString, tblFilters[1], "", false);
resRepString = String.Replace(resRepString, tblFilters[2], "", false);
resRepString = String.Replace(resRepString, tblFilters[3], "", false);
TextFile.WriteFromString("Data\\3.txt", resRepString, false);
------------------------------------------------------------------------
As the filter list grows so will grow the String.Replace procedure.
My question is this; how can i use the for loop here in order to make the script more flexible?
Any idea is appreciated.
Thank you
Sside