From: vanderghast on
Is there an easy way to make a comparison accent insensitive, a little bit
as, in MS SQL Server:


SELECT * FROM table WHERE project LIKE '%belanger%' COLLATE
Latin1_General_CI_AI


String.Compare( ) allows a case insensitivity (CI) but I am looking for an
accent insensitivity ( � == e, as example ), without having to Replace
explicitly all the possible accents for the based letter it is to be
considered equal.

From: AntFarmer on
Try using the CompareOptions.IgnoreNonSpace option:

String.Compare("e", "é", CultureInfo.CurrentCulture,
CompareOptions.IgnoreNonSpace)

If you want to make it case insensitive too:

String.Compare("e", "é", CultureInfo.CurrentCulture,
CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase)

Hope that works!


"vanderghast" wrote:

> Is there an easy way to make a comparison accent insensitive, a little bit
> as, in MS SQL Server:
>
>
> SELECT * FROM table WHERE project LIKE '%belanger%' COLLATE
> Latin1_General_CI_AI
>
>
> String.Compare( ) allows a case insensitivity (CI) but I am looking for an
> accent insensitivity ( é == e, as example ), without having to Replace
> explicitly all the possible accents for the based letter it is to be
> considered equal.
>
> .
>
From: vanderghast on
That works fine. I skipped over the "IgnoreNonSpace" at first, but that is
exactly what I was looking for.




"AntFarmer" <AntFarmer(a)discussions.microsoft.com> wrote in message
news:D5FDE657-CE98-48E0-9F8C-2DBD7813EBEB(a)microsoft.com...
> Try using the CompareOptions.IgnoreNonSpace option:
>
> String.Compare("e", "é", CultureInfo.CurrentCulture,
> CompareOptions.IgnoreNonSpace)
>
> If you want to make it case insensitive too:
>
> String.Compare("e", "é", CultureInfo.CurrentCulture,
> CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase)
>
> Hope that works!
>
>
> "vanderghast" wrote:
>
>> Is there an easy way to make a comparison accent insensitive, a little
>> bit
>> as, in MS SQL Server:
>>
>>
>> SELECT * FROM table WHERE project LIKE '%belanger%' COLLATE
>> Latin1_General_CI_AI
>>
>>
>> String.Compare( ) allows a case insensitivity (CI) but I am looking for
>> an
>> accent insensitivity ( é == e, as example ), without having to Replace
>> explicitly all the possible accents for the based letter it is to be
>> considered equal.
>>
>> .
>>

From: Peter Duniho on
vanderghast wrote:
> That works fine. I skipped over the "IgnoreNonSpace" at first, but that
> is exactly what I was looking for.

Careful. It will only ignore "nonspacing combining characters". There
are characters in the Unicode space that are accented as individual
characters, and these will still be compared as non-equal to unaccented
characters.

The success of using the IgnoreNonSpace flag will depend entirely on the
source of the accented characters and how they are entered.

Pete
From: vanderghast on
I have heard of such characters (Swedish/Finnish come to mind, but can be
wrong), but fortunately, for now, there are not part of the targeted
"cultures".



"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> wrote in message
news:uYdemiHaKHA.196(a)TK2MSFTNGP05.phx.gbl...
> vanderghast wrote:
>> That works fine. I skipped over the "IgnoreNonSpace" at first, but that
>> is exactly what I was looking for.
>
> Careful. It will only ignore "nonspacing combining characters". There
> are characters in the Unicode space that are accented as individual
> characters, and these will still be compared as non-equal to unaccented
> characters.
>
> The success of using the IgnoreNonSpace flag will depend entirely on the
> source of the accented characters and how they are entered.
>
> Pete