[fpc-devel] StrUtils unit (is poorly implemented)

Flávio Etrusco flavio.etrusco at gmail.com
Tue Mar 30 11:56:20 CEST 2010


On Tue, Mar 30, 2010 at 6:04 AM, Marco van de Voort <marcov at stack.nl> wrote:
> In our previous episode, Fl?vio Etrusco said:
>>
>> Second question: In current code, when ASubText is '', AnsiStartStr
>> returns False and
>> AnsiEndsStr returns True. Is this correct?
>
> If the string='' then ansistartsstr returns true and endstr false
>
> if they string<>'' then both return false.

I don't quite follow. This is what I get:

AnsiStartsStr('', '')      = FALSE
AnsiStartsStr('', 'aaa') = FALSE
AnsiEndsStr('', '')       = TRUE
AnsiEndsStr('', 'ab')    = TRUE

Should I retain this behavior or what?


> I'm using the Dutch locale in windows 7.
>
> Warning: one of the reasons I never bothered with the ansi* routines is:
> - they are supposed to be locale dependant in their comparisons.
> - they have support for mbcs versions of eastern locale codepages, where
>   chars are not one byte.

Sure. I know this would be relevant for sorting, but are there a
locale were different byte sequences should be considered equal?
Actually I guess that there are (like ae vs æ?), but anyway using
CompareMem is better than the current implementation.


> For these reasons, I left them high and dry till we have a bit more
> direction on unicode. (which might skip them all together)

I imagined that.

Best regards,
Flávio



More information about the fpc-devel mailing list