Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   using isnumeric (http://www.velocityreviews.com/forums/t796732-using-isnumeric.html)

Joey 10-14-2004 12:30 PM

using isnumeric
 
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 ***
Don't just participate in USENET...get rewarded for it!

Bob Barrows [MVP] 10-14-2004 01:25 PM

Re: using isnumeric
 
Joey wrote:
> 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?
>



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 02:59 PM

Re: using isnumeric
 
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


"Joey" <nospam@infosmiths.net> wrote in message
news:%23kPXamesEHA.2144@TK2MSFTNGP10.phx.gbl...
> 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 ***
> Don't just participate in USENET...get rewarded for it!





All times are GMT. The time now is 11:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.