[fpc-pascal] docs for TStringList.CaseSensitive seem incomplete

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Nov 16 17:43:38 CET 2016


Hi,

I did some testing and it seems the CaseSensitive property also has an
affect on the Sort() method. Yet the documentation only lists that the
property affects locating of strings.


http://www.freepascal.org/docs-html/current/rtl/classes/tstringlist.casesensitive.html

...versus the Delphi help, which explicitly mentions actions like
locate, sort and identify (eg: duplicates).


http://docwiki.embarcadero.com/Libraries/Berlin/en/System.Classes.TStringList.CaseSensitive


Here is the results of my test application:

With CaseSensitive = True
==========================
 $ ./project1
GSUB
OS/2
cmap
cvt
fpgm
glyf
head
hhea
loca
prep


With CaseSensitive = False
==========================
 $ ./project1
cmap
cvt
fpgm
glyf
GSUB
head
hhea
loca
OS/2
prep



So CaseSensitive = True definitely affects sorting too, not just
locating strings.  But will this always be true for TStringList, or
could the implementation change (hence some details omitted from the
documentation).



The complete test application:

================================
program project1;

{$mode objfpc}{$H+}

uses
  Classes, Sysutils;

var
  sl: TStringList;
  i: integer;
begin
  sl := TStringList.Create;
  sl.Add('fpgm');
  sl.Add('cvt ');
  sl.Add('head');
  sl.Add('glyf');
  sl.Add('cmap');
  sl.Add('hhea');
  sl.Add('OS/2');
  sl.Add('prep');
  sl.Add('GSUB');
  sl.Add('loca');

//  sl.CaseSensitive := True;
  sl.Sort;

  for i := 0 to sl.Count-1 do
    writeln(sl[i]);

  sl.Free;
end.
================================

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list