[fpc-pascal]TStringList.indexOf (case-sensitivity)

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Aug 27 15:03:31 CEST 2003


On Wed, 27 Aug 2003, James Mills wrote:

> On Wed, Aug 27, 2003 at 09:39:10AM +0200, Michael Van Canneyt wrote:
> >
> >
> > On Wed, 27 Aug 2003, James Mills wrote:
> >
> > > Hi,
> > >
> > > Is TStringList.indexOf case sensitive or insensitive ?
> > > TStrings.indexOf is case insensitive, but TStringList.indexOf overrides
> > > the TStrings.indexOf implementation accoriding to the documentation.
> >
> > It is case insensitive, but this was changed recently for Delphi
> > compatibility.
> > Older versions are case sensitive. Here are the relevant log entries:
> >
> > revision 1.15
> > date: 2003/05/29 23:13:57;  author: michael;  state: Exp;  lines: +5 -2
> > fixed case insensitivity of TStrings.IndexOf
> > ----------------------------
> > revision 1.14
> > date: 2002/12/10 21:05:44;  author: michael;  state: Exp;  lines: +12 -5
> > + IndexOfName is case insensitive
> > ----------------------------
>
> Is there no other function that searches the list in a case insensitive
> way ? I've been looking through the current FCL source and speaking to a
> member of the list...

No. IndexOf() is meant to search the list. In D7, there is a property
'CaseSensitive' which determines whether the search is performed case
sensitively or not...

>
> It seems perhaps I should write a descendant of TStringList, which I've
> done and works for my purpose.

This is always possible, that is why we have OOP.

>
> The other query I have with TStringList, is the sqlite unit uses
> CommaText which replaces " with "" and other side affects you don't want
> in an IRC Services application.

Then you don't need commatext, but plain old 'text'.
The idea of commatext is exactly that it replaces " with ""...

Michael.





More information about the fpc-pascal mailing list