Page 1 of 1

[REL] Case & Windows page code insensitive FindFullLine

Posted: 2011-03-07 19:30:05
by PhGrivel
Here is how I modify the FindFullLine Function
in StringUtils1 to have these functionnality working:

Code: Select all

// *****
{    Same as FindFullLine but take the IgnoreCase into account with ASCII standards
     Returns -1 if not found   }
//  PhG

function FindFullLineWithoutCase(Line: string; List: TStringList; StartAt: Integer; IgnorCase: Integer ): Integer;
var
  i: Integer;
  LookIn: string;
begin
  result := -1;
  if StartAt < 0 then
    StartAt := 0;
  if IgnorCase = 1 then Line := Cp1252ToASCII(AnsiLowerCase(Line));
  for i := StartAt to List.Count-1 do
    LookIn := List.GetString(i);
    if IgnorCase = 1 then LookIn := Cp1252ToASCII(AnsiLowerCase(LookIn));
    if Line = LookIn then
      begin
        result := i;
        Break;
      end;
end;
It helped me particulary well with the Find Duplicates script as many titles are written in french.

For what that's worth.
PhG