hi Graham,
I posted some code too ... using
If sChar Like "[0-9,A-Z]" ThenI wonder which way is faster ...
have an awesome day,
crystal
Hi Steve
Funny – I posted a function very similar to this for Kevin just three weeks ago. He wanted to keep only the numerics, so I've modified it for you:
Public Function KeepOnlyAlphaNumeric( strIn as String ) As String
Dim strOut As String
Dim ch as String
Dim i as Integer
For i = 1 To Len(strIn)
ch = Mid(strIn, i, 1)
Select Case ch
Case "0" To "9", "A" To "Z", "a" To "z"
strOut = strOut & ch
End Select
Next i
KeepOnlyAlphaNumeric = strOut
End FunctionWarmly,
Graham
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Saturday, 26 May 2018 09:12
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Retain only the letters and numbers in a string
In the snippet of code below, CombinedInfo is a string containing upper
and lower case letters, numbers, spaces and assorted special characters
such as &, *, $, #, @, etc. I need to delete the spaces and special
characters, retaining only the letters (upper and lower case) and
numbers. What type of test can I use in the For-Next loop to do that?
For MyCounter = 1 To Len(CombinedInfo)
Debug.Print MyCounter & " " & Mid(CombinedInfo, MyCounter, 1)
Next MyCounter
Thanks, Steve
Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar