Groups | Blog | Home
all groups > inetserver asp general > october 2004 >

inetserver asp general : using isnumeric


Joey
10/14/2004 5:30:33 AM
I am using an import process that scans an html file and exports data to
a sql database table.

One of the fields I import, on occasion has 2 numeric characters at the
very end. For example "thename 04".

What I need to do is delete those numeric characters, if they exist.

I thought about something like this:
if isnumeric(right(thename,2))=TRUE then

....but what's next? How do I make a new THENAME field without those
last two numeric characters if they exist?

Thanks for the help!


*** Sent via Developersdex http://www.developersdex.com ***
Bob Barrows [MVP]
10/14/2004 9:25:43 AM
[quoted text, click to view]


To do it in vbscript, you would do this:

thename = left(thename,len(thename)-2)


Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Manohar Kamath
10/14/2004 9:59:09 AM
You say "if they exist" -- meaning they may not? If so, you could do the
following:

Dim stringArray
dim namePart

' Split the string on the empty space
stringArray = Split(theName, " ")

' Retrieve the string before the space. if the space does not
' exist, you will get the entire string
namePart = stringArray(0)

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com


[quoted text, click to view]

AddThis Social Bookmark Button