[fpc-pascal] Bug in AnsiCompareText of cwstring

Martin Schreiber mse00000 at gmail.com
Wed Nov 27 16:13:02 CET 2013


On Wednesday 27 November 2013 13:05:29 Mattias Gaertner wrote:
> Hi all,
>
> When using the cwstring widestringmanager the function AnsiCompareText
> seems to have a bug.
>
> For example:
>
> {$mode objfpc}{$H+}
>
> uses
>   Classes, SysUtils, cwstring;
> begin
>   writeln('o   and .   gives ',AnsiCompareText('o','.'));
>   writeln('oc  and .o  gives ',AnsiCompareText('oc','.o'));
>   writeln('oce and .ou gives ',AnsiCompareText('oce','.ou'));
> end.
>
> Result:
>
> o   and .   gives 1
> oc  and .o  gives 1
> oce and .ou gives -18
>
Possibly as intended because the collation of the current locale ignores 
punctuation.

Martin



More information about the fpc-pascal mailing list