SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Guest

    Change String to Integer

    I am changing String values to Integer to verify calculation.But when it converts to Integer decimals are dis appeared.Is any fix OR function for it.
    MktPrice = (MYpage.Data.NextGainLoss.MarketPrice.GetRowText (1))
    [ ] print ("MktPrice")
    [ ] print (MktPrice)
    [ ] iMktPrice = val (MktPrice)
    [ ] print ("iMktPrice")
    [ ] print (iMktPrice)

    Mrketprice =19.45 String
    Mrketprice =19 Integer

    ------------------

  2. #2
    Member
    Join Date
    Jul 2001
    Location
    NY, USA
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change String to Integer

    try some thing like this. it should work for you

    [ ] const string p ="19.45"
    [ ] number n
    [ ]
    [ ]
    [-] testcase tee() appstate none
    [ ] n=val(p)
    [ ] print (n)



    ------------------

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change String to Integer

    Using type Number works for some reason(as mentioned above).

    Try something like that for fun.

    non-tested but make sense

    int myVal(string num)
    string A=GetField(num,".",1)
    string B=GetField(num,".",2)

    int iA=val(A)
    int iB=val(B)

    int iWhole=A+.1*iB
    return iWhole

    ex: "100.98"

    A=100
    B=98
    iTotal = 100 + .1*98 =100.98

    no extra zero attached to it.

    ------------------

  4. #4
    Member
    Join Date
    Dec 2000
    Location
    San Francisco, CA
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change String to Integer

    in·te·ger (nt-jr)
    n. Mathematics
    1. A member of the set of positive whole numbers {1, 2, 3,... }, negative whole numbers {-1, -2, -3,... }, and zero {0}.
    2. A complete unit or entity.

    ------------------
    kalabog73@hotmail.com

  5. #5
    Senior Member
    Join Date
    Aug 2001
    Location
    Manchester, NH
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change String to Integer

    I think most of us have forgotten and been rudely reminded about a definition at some point, I was the victim of looking for decimals in a long not so long ago

    ------------------
    Adam Kuczkowski
    akuczkowski@echoman.com

  6. #6
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Change String to Integer

    lol; that hurts. Anyhow I understood what you wanted regardless of the misuse of the word integer.



    ------------------

  7. #7
    Guest

    Re: Change String to Integer

    Thanks for all,specially for Adam. It was victim of 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
  •  

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 07:27 PM.

Copyright BetaSoft Inc.