[REL] Case & Windows page code insensitive FindFullLine

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
PhGrivel
Posts: 7
Joined: 2011-01-27 15:24:25

[REL] Case & Windows page code insensitive FindFullLine

Post 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
Post Reply