Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-11

docs for TStringList.CaseSensitive seem incomplete

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

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
Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote
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.

Can you please enter this in the bugtracker ? Otherwise I will forget it.

Michael.