List Info

Thread: Re: Accent Insensitive CultureInfo (or at least DataTable.Select)




Re: Accent Insensitive CultureInfo (or at least DataTable.Select)
country flaguser name
Portugal
2008-06-08 10:06:34
I ended up using a RemoveDiacritics function to send the
text to the
"Select" function, and using a NoDiacritics
columns on the database. I used
the same function to create the No Diactricts column on the
table. 
But I think this is a serious error in the DataTable
functionality.

Here's the function I used:

    Public Function RemoveDiacritics(ByVal stIn As String)
As String
        Dim stFormD As String =
stIn.Normalize(NormalizationForm.FormD)
        Dim sb As New StringBuilder()
        For ich As Integer = 0 To stFormD.Length - 1

            Dim uc As UnicodeCategory =
CharUnicodeInfo.GetUnicodeCategory(stFormD(ich))
            If uc <> UnicodeCategory.NonSpacingMark
Then
                sb.Append(stFormD(ich))
            End If
        Next

        Return (sb.ToString())
    End Function

I didn't invent it, I took from
http://blogs.msdn.com/michkap/archive/2005/02/19/376
617.aspx 

Alll the best,
Joel Paula
Managing Partner 
Scientia - Análise e Desenvolvimento de Software, Lda. 
IM: joelpaulahotmail.com
www.scientia.pt 
 








-----Original Message-----
From: Sébastien Lorion [mailto:sebastien.lorionGMAIL.COM] 
Sent: Friday, June 06, 2008 7:30 AM
Subject: Re: Accent Insensitive CultureInfo (or at least
DataTable.Select)

I would be interested in a follow-up to this question, if
possible. Thank
you !

Sébastien

On 6/4/08, Joel Paula <jpscientia.pt> wrote:
> Thanks for your interest.
>
>  I can build any CultureInfo, but the problem is with
CompareInfo. I am
not
>  able to create a CompareInfo class. I think that if I
was able to create
>  one, I would make it so that it ignores Accents.
>
>  Any ideas?
>
>
>  Joel
>
>
>  On Wed, 4 Jun 2008 08:01:27 -0500, Booth, Bill
>  <BBoothPANAMERICANLIFE.COM> wrote:
>
>  >Have you looked into creating a custom culture
using the
>  CultureAndRegionInfoBuilder class?
>  >
>  >
>  >
>  >-----Original Message-----
>  >From: Discussion of advanced .NET topics.
[mailto:ADVANCED-
>  DOTNETDISCUSS.DEVELOP.COM] On Behalf Of Joel Paula
>  >Sent: Tuesday, June 03, 2008 16:33
>  >To: ADVANCED-DOTNETDISCUSS.DEVELOP.COM
>  >Subject: [ADVANCED-DOTNET] Accent Insensitive
CultureInfo (or at least
>  DataTable.Select)
>  >
>  >I have a DataTable with data in it. I use the
Select method to "find"
>  >certain rows. The problem with this method is that
it performs an Accent
>  >Sensitive filter on the data. I need Accent
Insensitive:
>  André=Andrè=Andre.
>  >
>  >I tried setting the DataTable Locale to
CultureInvariant but it doesn't
>  >solve my problem. I can't find any information on
how to create an
Accesnt
>  >Insensitive CultureInfo. I also see the DataTable
has a private
>  >CompareInfo field but I can't access it.
>  >
>  >If anyone can provide any kind of pointers to
possible solutions, I
would
>  >appreciate it.
>  >
>  >Thanks.
>  >Joel
>  >
>  >===================================
>  >This list is hosted by DevelopMentor(R)  http://www.develop.com
>  >
>  >View archives and manage your subscription(s) at
>  http://discuss.develop.com

>  >
>  >The information in this e-mail is confidential,
may be legally
privileged
>  and is intended solely for the addressee. If you have
received this
e-mail
>  in error, you are hereby notified that any use,
distribution, or copying
>  of this communication is strictly prohibited.
>  >
>  >===================================
>  >This list is hosted by DevelopMentor(R)  http://www.develop.com
>  >
>  >View archives and manage your subscription(s) at
>  http://discuss.develop.com

>
>  ===================================
>  This list is hosted by DevelopMentor(R)  http://www.develop.com
>
>  View archives and manage your subscription(s) at
http://discuss.develop.com

>


-- 
Sébastien
www.sebastienlorion.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )