How can I get TStringList to sort differently in Delphi

后端 未结 3 1864
太阳男子
太阳男子 2020-12-14 10:41

I have a simple TStringList. I do a TStringList.Sort on it.

Then I notice that the underscore \"_\" sorts before the capital letter \"A\". This was in contrast to a

3条回答
  •  死守一世寂寞
    2020-12-14 11:10

    AnsiCompareStr (CompareString with LOCALE_USER_DEFAULT) has fault, because it gets characters with punctation as equal:

    e1 é1 e2 é2

    Correct order is (for example for Czech):

    e1 e2 é1 é2

    Does anybody know how to avoid this error in ordering?


    11.2.2010: I must apologize described behavior is fully according linguistic rules. Although I think it is silly and "bad" it is not error in API function.

    Explorer in Windows XP uses so called intuitive filname ordering which gives better results but it can't be used programatically.

提交回复
热议问题