Thanks:  0
Likes:  0
Dislikes:  0

# Thread: Change String to Integer

1. ## 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. ## 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. ## 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. ## 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. ## 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

------------------
akuczkowski@echoman.com

6. ## Re: Change String to Integer

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

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

7. ## 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
•
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.