Re: Filter string to remove non-utf-8 characters
- From: "bloodfart" <infomaniac2000@xxxxxxxxx>
- Date: 26 Oct 2006 15:52:50 -0700
BTW, I tried this:
testVar = "as§d asdf... "
'Create a regular expression object
Dim regEx
Set regEx = New RegExp
'The global property tells the RegExp engine to find ALL matching
'substrings, instead of just the first instance. We need this to be
true.
regEx.Global = true
'Our pattern tells us what to find in the string... In this case, we
find
'anything that isn't a numerical character, or a lowercase or
'uppercase alphabetic character
regEx.Pattern = "[^0-9a-zA-Z]"
'Use the replace function of RegExp to clean the username. The replace
'function takes the string to search (using the Pattern above as the
'search criteria), and the string to replace any found strings with.
'In this case, we want to replace our matches with nothing (''),
'as the matching characters will be the ones we don't want in our
username.
dim username
username = regEx.Replace(testVar, "")
But, writing testVar still contains §.
.
- References:
- Filter string to remove non-utf-8 characters
- From: bloodfart
- Filter string to remove non-utf-8 characters
- Prev by Date: Re: Filter string to remove non-utf-8 characters
- Next by Date: Re: Why wouldn't this work?
- Previous by thread: Re: Filter string to remove non-utf-8 characters
- Next by thread: Re: Filter string to remove non-utf-8 characters
- Index(es):
Relevant Pages
|