Code: Select all
WordList = 'Mike,Joe,Diane,Zack,Yany,Joe,Marie,David,Mike,Ken';
// Note that the above contain duplicates.
// Make all the words one per line...
WordList.Replace(',', crlf);
// Set our database file name and path...
DataFileName = ScriptPath + '$data.dat';
// Create our database object...
DF = New(DataFile);
// Open the database...
DF.Open(DataFileName);
// Make the database indexed in ascending order...
DF.SortedIndex;
// Empty the database...
DF.Truncate;
// Iterate through the all the words...
for each WordList as aWord do begin
// If the word does not exist in the database...
if DF.Find(aWord) < 1 then
// then add it...
DF.Append(aWord);
end;
// Close the database...
DF.Close;
Output.Clear;
// Reopen the databse...
DF.Open(DataFileName);
// Output every sorted records...
for x = 1 to DF.Count do
Output(DF.Read(x));
DF.Close;