[Mono-list] String comparisons slow
Atsushi Eno
atsushieno at veritas-vos-liberabit.com
Thu Jul 22 02:23:52 EDT 2010
While jonp has already explained it though...
StringComparison.Ordinal means comparison in Unicode character codepoint
order.
Invariant comparison is culture-aware comparison that includes "natural"
sortings (i.e. sorting like A->a->B->b), processing combined characters
(AE == \u00C6) etc.
They are mostly common to all cultures, while there are some difference
between cultures e.g. CJK ideography character sortings differ a lot
among those cultures. Some Latin1 character orders differ for each
European culture.
For more details, see Collation-notes.txt in
corlib/Mono.Globalization.Unicode:
http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/corlib/Mono.Globalization.Unicode/Collation-notes.txt
Atsushi Eno
On 2010/07/22 14:50, Alexander M. Batishchev wrote:
> Michael, could you please clarify the difference between Ordinal and
> Invariant string comparison?
>
> -----Original Message-----
> From: mono-list-bounces at lists.ximian.com
> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Michael Hutchinson
> Sent: Thursday, July 22, 2010 12:29 AM
> To: David S
> Cc: mono-list at lists.ximian.com; wtftc
> Subject: Re: [Mono-list] String comparisons slow
>
> On Wed, Jul 21, 2010 at 3:30 PM, David S<buttink at gmail.com> wrote:
>
>> Ok. Now I'm confused. How come "CurrentCulture" for US/ENG doesn't just
>>
> run
>
>> the Ordinal??? Perhaps there are some weird alphabetizing things I just
>> don't understand. BTW, Thanks for tell us about the StringComparer class.
>>
> I
>
>> never knew that existed.
>>
> Note also that some string methods have overloads for taking specific
> cultures, or the StringComparison enum. Both StringComparison.Ordinal
> and StringComparison.OrdinalIgnoreCase (as well as StringComparer) can
> be very useful to improve performance when culture-dependent behaviour
> is not needed or desirable.
>
> Culture-dependent string comparisons are a very complex topic. There's
> also an "invariant" culture for doing things in a culture-independent
> way.
>
>
More information about the Mono-list
mailing list