Sign in Join

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

Mailing lists / fpc-pascal / 2006-05

string comparison on various platforms

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Marc Santhoff

Hi,

from digging the sources I know, that on Unix-like Systems the comparison of strings is done according to the current locale (Pascals "strcomp" is mapped to C-libs "strcoll").

Can I assume that this is done similar on all other platforms, too?

I'm asking myself if I have to consider something special when sorting strings or if a comparison using the RTL function will allways be "correct" (not talking of special sort orders for rarely occuring cases).

TIA,
Marc

Geno Roupsky
to Marc Santhoff

2006/5/3, Marc Santhoff :

Show quoted text 8 lines
Hi, from digging the sources I know, that on Unix-like Systems the comparison of strings is done according to the current locale (Pascals "strcomp" is mapped to C-libs "strcoll"). Can I assume that this is done similar on all other platforms, too?

At least where is is possible, I mean where the OS supports locales

I'm asking myself if I have to consider something special when sorting

strings or if a comparison using the RTL function will allways be "correct" (not talking of special sort orders for rarely occuring cases).

Yes, if for any reason you stumble upon a bug it is most probably due to miss configuring the OS locale definitions.

Geno Roupsky
Marc Santhoff
to Geno Roupsky
Geno Roupsky wrote 14 lines
2006/5/3, Marc Santhoff : Hi, from digging the sources I know, that on Unix-like Systems the comparison of strings is done according to the current locale (Pascals "strcomp" is mapped to C-libs "strcoll"). Can I assume that this is done similar on all other platforms, too? At least where is is possible, I mean where the OS supports locales

So I can use it the way it is on Windows, FreeBSD, Linux and (I think) MacOS. That's pretty much.

Show quoted text 10 lines
I'm asking myself if I have to consider something special when sorting strings or if a comparison using the RTL function will allways be "correct" (not talking of special sort orders for rarely occuring cases). Yes, if for any reason you stumble upon a bug it is most probably due to miss configuring the OS locale definitions.

No bug, I'm only planning.

Thank for helping,
Marc