SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Dec 2000
    Location
    Pune, India
    Posts
    135
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to convert a STRING 9999.99 into INTEGER 9999.99 ?

    How to convert a STRING into INTEGER?

    eg. STRING 9999.99 into INTEGER 9999.99


    [This message has been edited by Prasad (edited 01-18-2001).]

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert a STRING 9999.99 into INTEGER 9999.99 ?

    Well, the standard way of converting a string representation of a number into a numeric type, is by use of the Str() function.
    e.g. integer i = Str("4568")
    You might want to take care though - 9999.99 isn't an integer. You'll need to convert it to a real or number type.

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert a STRING 9999.99 into INTEGER 9999.99 ?

    Have you tried using the Val command?

    STRING str = 10
    INTEGER i

    i = Val(str)
    print ("i = {i}")
    *prints out* i = 10

    I'm pretty sure it allows you to specify a real number instead of an integer as well... just check the help menu for "Val".

    I think the Str command converts numbers to strings, probably not what you're looking for.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    186
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert a STRING 9999.99 into INTEGER 9999.99 ?

    Not sure if it will matter for you, but I though I would mention commas. If your string has commas, you need to strip them out. Here is an example. Note the difference in the output.

    [ ] real r
    [ ] string s = "999,999.99"
    [ ] r=val(s)
    [ ] print(r)
    [ ] s = strtran(s,",","")
    [ ] r=(val(s))
    [ ] print(r)

    Output:
    [ ] 999.000000
    [ ] 999999.990000

    Tom

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:32 PM.

Copyright BetaSoft Inc.