All,
Is there such a function that can strip all non alpha ( not between a-z)
characters from a string? I have a function that I currently use that will
strip one character at a time from a string that I tried tweaking without
success. Any help would be much appreciated.
Thanks in advance,
Mark C. he******@yahoo.com 6 9052
Function StripAlphaChars(strOriginalString As String) As String
Dim intLoop As Integer
Dim strTemp As String
strTemp = strOriginalString
For intLoop = Asc("A") To Asc("Z")
strTemp = Replace(strTemp, Chr(intLoop), "", 1, -1, vbTextCompare)
Next intLoop
StripAlphaChars = strTemp
End Function
--
Ken Snell
<MS ACCESS MVP>
"Mark C" <he******@yahoo.com> wrote in message
news:4d********************@comcast.com... All,
Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that will strip one character at a time from a string that I tried tweaking without success. Any help would be much appreciated.
Thanks in advance, Mark C. he******@yahoo.com
Oops -- Sorry, I misread your post. This will strip numeric characters from
the string. If you want to cover other alpha characters, such as French or
German alpha characters, you can modify the For loop parameters as needed.
Full "width" of ASCII characters is 0 to 255 for Chr(x) function (x = 0 to
255).
Function StripNumberChars(strOriginalString As String) As String
Dim intLoop As Integer
Dim strTemp As String
On Error Resume Next
strTemp = strOriginalString
For intLoop = Asc("0") To Asc("9")
strTemp = Replace(strTemp, Chr(intLoop), "", 1, -1, vbTextCompare)
Next intLoop
StripNumberChars = strTemp
Err.Clear
End Function
"Mark C" <he******@yahoo.com> wrote in message
news:4d********************@comcast.com... All,
Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that will strip one character at a time from a string that I tried tweaking without success. Any help would be much appreciated.
Thanks in advance, Mark C. he******@yahoo.com
There are always, of course, lots of ways of doing these things. Here's
another approach (adapted from Ken's):
Function StripAlphaChars(strOriginalString As String) As String
Dim intLoop As Integer
Dim strTemp As String
Dim strChar As String
strTemp = ""
For intLoop = 1 To Len(strOriginalString)
strChar = Mid$(strOriginalString, intLoop, 1)
Select Case Asc(strChar)
' Upper case chars [A-Z]
Case 65 To 90: strTemp = strTemp & strChar
' Lower case chars [a-z]
Case 97 To 122: strTemp = strTemp & strChar
Case Else
End Select
Next intLoop
StripAlphaChars = strTemp
End Function
HTH,
Randy
"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:up**************@TK2MSFTNGP09.phx.gbl... Oops -- Sorry, I misread your post. This will strip numeric characters
from the string. If you want to cover other alpha characters, such as French or German alpha characters, you can modify the For loop parameters as needed.
Full "width" of ASCII characters is 0 to 255 for Chr(x) function (x = 0 to 255).
Function StripNumberChars(strOriginalString As String) As String Dim intLoop As Integer Dim strTemp As String On Error Resume Next strTemp = strOriginalString For intLoop = Asc("0") To Asc("9") strTemp = Replace(strTemp, Chr(intLoop), "", 1, -1, vbTextCompare) Next intLoop StripNumberChars = strTemp Err.Clear End Function "Mark C" <he******@yahoo.com> wrote in message news:4d********************@comcast.com... All,
Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that
will strip one character at a time from a string that I tried tweaking
without success. Any help would be much appreciated.
Thanks in advance, Mark C. he******@yahoo.com
Thanks ken, The function worked perfectly.
Regards,
Mark C. he******@yahoo.com
"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message
news:up**************@TK2MSFTNGP09.phx.gbl... Oops -- Sorry, I misread your post. This will strip numeric characters
from the string. If you want to cover other alpha characters, such as French or German alpha characters, you can modify the For loop parameters as needed.
Full "width" of ASCII characters is 0 to 255 for Chr(x) function (x = 0 to 255).
Function StripNumberChars(strOriginalString As String) As String Dim intLoop As Integer Dim strTemp As String On Error Resume Next strTemp = strOriginalString For intLoop = Asc("0") To Asc("9") strTemp = Replace(strTemp, Chr(intLoop), "", 1, -1, vbTextCompare) Next intLoop StripNumberChars = strTemp Err.Clear End Function "Mark C" <he******@yahoo.com> wrote in message news:4d********************@comcast.com... All,
Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that
will strip one character at a time from a string that I tried tweaking
without success. Any help would be much appreciated.
Thanks in advance, Mark C. he******@yahoo.com
You're welcome.
--
Ken Snell
<MS ACCESS MVP>
"Mark C" <he******@yahoo.com> wrote in message
news:k7********************@comcast.com... Thanks ken, The function worked perfectly.
Regards, Mark C. he******@yahoo.com
"Ken Snell" <kt***********@ncoomcastt.renaetl> wrote in message news:up**************@TK2MSFTNGP09.phx.gbl... Oops -- Sorry, I misread your post. This will strip numeric characters from the string. If you want to cover other alpha characters, such as French
or German alpha characters, you can modify the For loop parameters as
needed. Full "width" of ASCII characters is 0 to 255 for Chr(x) function (x = 0
to 255).
Function StripNumberChars(strOriginalString As String) As String Dim intLoop As Integer Dim strTemp As String On Error Resume Next strTemp = strOriginalString For intLoop = Asc("0") To Asc("9") strTemp = Replace(strTemp, Chr(intLoop), "", 1, -1, vbTextCompare) Next intLoop StripNumberChars = strTemp Err.Clear End Function "Mark C" <he******@yahoo.com> wrote in message news:4d********************@comcast.com... All,
Is there such a function that can strip all non alpha ( not between
a-z) characters from a string? I have a function that I currently use that will strip one character at a time from a string that I tried tweaking without success. Any help would be much appreciated.
Thanks in advance, Mark C. he******@yahoo.com
> > "Mark C" <he******@yahoo.com> wrote in message news:4d********************@comcast.com... All,
Is there such a function that can strip all non alpha ( not between
a-z)
Guess I misunderstood. I thought that meant that you might want to strip
characters besides digits, such as punctuation and control characters, as
well.
characters from a string? I have a function that I currently use that will strip one character at a time from a string that I tried tweaking without success. Any help would be much appreciated.
Thanks in advance, Mark C. he******@yahoo.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jason |
last post by:
How would I strip out everything from before the last "/" in the following
string generated from request.servervaraibles method:
http://www.essermanyachtsales.com/riverbend/
....so that I was...
|
by: Giampiero Gabbiani |
last post by:
Hi to all,
Is there a simple way to implement a strip algorithm on std::string using
STL?
I'm sure that it's possible to implement it using some transform, but my
knowledge of STL is POOR.
...
|
by: ineedyourluvin1 |
last post by:
Hello all! I've been looking for a way to strip characters from strings
such as a comma. This would be great for using a comma
as a delimiter. I show you what I have right now.
...
|
by: Steve Bergman |
last post by:
When sanitizing data coming in from HTML forms, I'm doing this (lifted
from the Python Cookbook):
from string import maketrans, translate, printable
allchars = maketrans('','')
delchars =...
|
by: PCV |
last post by:
Hi All,
I want to create a custom auto number in a form that looks like
"CRA05001" where "CR" are fixed characters, then "A" should be for
January as "B" for February and so on...(this part will...
|
by: Tim Conner |
last post by:
I wrote the following function to test a string for
characters from a to z and the "_" character :
public static bool IsAlpha( char Value )
{
Regex regExp = new Regex("^*$");
if...
|
by: David Beck |
last post by:
I donwnload some files for processing every day that have unwanted
characters in them. In VB6 I use the InputB to read in the text and the
StrConv.
vLinesFromFile =...
|
by: Brian Henry |
last post by:
Is there any quick and easy (other then scanning a string char by char) to
remove all the alpha chars from a string and leave only numbers?
ex:
A12334234-3431AP
comes out to 123342343431...
|
by: Andrew Sweney |
last post by:
I have a system that generates a 24ch alpha-numeric string as a tracking number. An example looks like this - 1898240001631501AKL003HS.
This is great for what it does (there is information...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |