using isnumeric

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joey

    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))=TR UE 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]

    #2
    Re: using isnumeric

    Joey wrote:[color=blue]
    > 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))=TR UE then
    >
    > ...but what's next? How do I make a new THENAME field without those
    > last two numeric characters if they exist?
    >[/color]


    To do it in vbscript, you would do this:

    thename = left(thename,le n(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"


    Comment

    • Manohar Kamath

      #3
      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



      "Joey" <nospam@infosmi ths.net> wrote in message
      news:%23kPXames EHA.2144@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      > 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))=TR UE 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![/color]


      Comment

      Working...