[fpc-pascal] LowerCase vs. UnicodeLowerCase

LacaK lacak at zoznam.sk
Tue Oct 11 08:58:40 CEST 2016


One problem is, that documentation of SysUtils.LowerCase is not correct 
regarding to System.LowerCase
http://www.freepascal.org/docs-html/rtl/sysutils/lowercase.html :
"... It is completely equivalent to the *lowercase function of the 
system unit*"

But another problem, which I have pointed out, is that UnicodeString 
version of SysUtils.LowerCase hides System.LowerCase,
while SysUtils.LowerCase converts only A..Z but System.LowerCase uses 
widestringmanager so converts also accented characters.
So System.LowerCase is superset of SysUtils.LowerCase, but in most 
programs is hidden by SysUtils.

What seems to me logical, is oposite, that System unit has basic 
functionality, which is extended by SysUtils.
Now System unit has extended capability that is hidden by basic 
functionality of SysUtils ;-)

-Laco.

>>     writeln(LowerCase(US)); // prints ÁÉÍ
>>     writeln(UnicodeLowerCase(US)); // prints áéí
>>
>> Why first LowerCase() does nothing while second wroks as expected?
>>
> 	SysUtils.LowerCase is only supposed to work on ascii characters.
>  From manual:
> -----------------------------------------------------------------------
> LowerCase returns the lowercase equivalent of S. Ansi characters are not
> taken into account, only ASCII codes below 127 are converted. It is
> completely equivalent to the lowercase function of the system unit, and
> is provided for compatibility only.
> -----------------------------------------------------------------------
> 	But that last sentence suggests that System.LowerCase should work same
> way. But it's manual entry says:
> -----------------------------------------------------------------------
> Lowercase returns the lowercase version of its argument C. If its
> argument is a string, then the complete string is converted to
> lowercase. The type of the returned value is the same as the type of the
> argument.
> -----------------------------------------------------------------------
> 	So, which version is correct one? Delphi LowerCase also only
> works on ascii characters.
>



More information about the fpc-pascal mailing list