using isnumeric

Discussion in 'ASP General' started by Joey, Oct 14, 2004.

  1. Joey

    Joey Guest

    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!
    Joey, Oct 14, 2004
    #1
    1. Advertising

  2. 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"
    Bob Barrows [MVP], Oct 14, 2004
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:%...
    > 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!
    Manohar Kamath, Oct 14, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephan Bour

    IsNumeric C# equivalent

    Stephan Bour, Nov 5, 2003, in forum: ASP .Net
    Replies:
    12
    Views:
    243,934
    daniefvh
    Jan 26, 2012
  2. martin
    Replies:
    3
    Views:
    10,609
    Kevin Spencer
    Jul 19, 2004
  3. =?Utf-8?B?TXJNaWtl?=

    IsNumeric Function

    =?Utf-8?B?TXJNaWtl?=, Nov 29, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    4,853
    Dan Bass
    Nov 29, 2004
  4. David Lozzi

    Name 'IsNumeric' is not declared???

    David Lozzi, Dec 6, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    4,438
    David Lozzi
    Dec 7, 2004
  5. Steve Kershaw

    Is there any IsNumeric in C#?

    Steve Kershaw, Nov 3, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    78,523
    Bill.Kanzaki
    Feb 3, 2012
Loading...

Share This Page