#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    21
    Rep Power
    0

    Checking to make sure a TStringList doesn't contain any contents in a specific file


    Hello . I would love to filter a TStringList so that none of its strings are anything in a text file. the text file contains line delimited strings that the TStringList should be filtered from . Can anyone suggest something please .
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    40
    Rep Power
    11
    Like I understand it:

    You want one list with X elements, and another list (or file) with Y, and (X !Є Y)?

    Lets call X your first list (not the file, and Y the file's list)

    PHP Code:
      TStringList *= new TStringList;
      
    Y->LoadFromFile(filename);
      
      for (
    int i 0Y->Counti++)
        if (
    X->IndexOf(Y->Strings[i]) >= 0X->Delete(X->IndexOf(Y->Strings[i])); 
    I have not tested this, but I think it'll work.

IMN logo majestic logo threadwatch logo seochat tools logo