Results 1 to 5 of 5

Thread: Deleting from a variable...

  1. #1

    Thread Starter
    Junior Member Moebius's Avatar
    Join Date
    Aug 2002
    Posts
    22

    Deleting from a variable...

    I need to know how to delete from the end of a variable.
    ex: calc = 3432 to calc = 343, get it?
    "If toast always lands butter-side down, and cats always land on their feet, what happens if you strap toast on the back of a cat and drop it?" - Steven Wright

  2. #2
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    calc=left(calc,len(calc)-1)

  3. #3
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    oops, just notice that was a numeric variable ... try this:

    calc = Left(CStr(calc), Len(CStr(calc)) - 1)

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    If you need to retain the data type, I think you may need to do this...


    calc = cint(Left(CStr(calc), Len(CStr(calc)) - 1))


    EDIT: No, muddy's right, I had assumed that CSTR converts it to a string type

  5. #5
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    Originally posted by mendhak
    If you need to retain the data type, I think you may need to do this...


    calc = cint(Left(CStr(calc), Len(CStr(calc)) - 1))


    EDIT: No, muddy's right, I had assumed that CSTR converts it to a string type
    sir frog,

    I think it depends on the declared type of calc. if calc is integer then the calculation will be coerced (is that the right techy jargon?) to integer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width