Selasa, 07 Agustus 2012

[MS_AccessPros] Re: Removing forweign language characters

 

<devilsadvocate>Are you trying to remove the latin characters from a kanji text?</devilsadvocate>

Either way, the answer is "yes and no". The usual answer would be to loop through all characters in the string, knocking out all bytes which are neither digits nor lowercase letters nor uppercase letters and do not belong to some predefined set you decide are "non-foreign" (such as commas, semicolons, etc.) However, the success of this will depend on where the text is coming from (if it's coming from a WebService you may have to look for two byte sequences) and you being able to define which characters are "friendly" and which are "unfriendly".

Function StripNonFreindly(ThisVal as String) As String
Dim i As Integer, c as integer, Dummy as string
Dummy$ = vbNullString
For i = 1 To Len(ThisVal)
c = Asc(Mid(ThisVal, i, 1))
Select Case c
Case 48 to 58, 65 to 90, 97 to 122 ' Digits, Uppercase, Lowercase
Dummy = Dummy + Chr$(c)
case else
end select
Next
StripNonFreindly = Dummy
End Function

--- In MS_Access_Professionals@yahoogroups.com, Daryl Walke <darylwalke@...> wrote:
>
> Hello,
>  
> I am trying to remove foreign language characters from a string in Access.  Is there a way to do this? 
>  
> Thanks!
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar