Normalize All UTF8 Character into it's most standard format

前端 未结 1 344
暗喜
暗喜 2021-01-23 04:22

I used this code:

Public Function RemoveDiacritics(ByVal s As String) As String
    Dim normalizedString As String
    Dim stringBuilder As New StringBuilder
            


        
相关标签:
1条回答
  • 2021-01-23 04:46

    There's a couple resources that might be useful to you. You can find them here, and here. The first is a possible duplicate question with a few more functions that might help you figure out your problem. The second is an article that I stumbled upon while Googling your question. It turned out to be an excellent read.

    Something more practical was this:

    Public Function RemoveAccentMarks(ByVal s As String) As String
       Dim stringBuilder As New StringBuilder
       Dim c As Char
       For Each c In s
           Dim v As Char = Chr(Asc(c) And &H7F)
           stringBuilder.Append(v)
       Next
    
       Return stringBuilder.ToString
    End Function
    

    (Source - you'll need to scroll to the bottom, it was Bob Strunz who claimed that it worked for him!)

    Hope that helps, I rather enjoyed this question (upvote). It was fun, informative, and interesting!

    -sf

    0 讨论(0)
提交回复
热议问题