| View previous topic :: View next topic |
| Author |
Message |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Wed Feb 06, 2008 1:10 am Post subject: string to double ? (delphi) |
|
|
well i have a bit noobish question but i dont remember how i do it ....
how to i convert string to double ?
i get error of bouth these ...
StrToDouble
StrToSingle
or is it my compiler thats sux ? .....
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 475
Joined: 09 May 2003 Posts: 25974 Location: The netherlands
|
Posted: Wed Feb 06, 2008 3:32 am Post subject: |
|
|
StrToFloat
or
Val
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Wed Feb 06, 2008 5:01 am Post subject: |
|
|
http://www.faqts.com/knowledge_base/view.phtml/aid/25371/fid/175
searched on google, its a bit long but all you need is this
| Code: | function TForm1.FNMathGetStringToDoubleD( s : string ): double;
var d : double;
begin
d := StrToFloat( s ); // cast the result to a double (to be sure it
will become a double, and not a real)
result := d;
end; |
so you could just
| Code: | var
TheString : string;
DoubledString : Double;
begin
DoubledString := StrToFloat (TheString);
end; |
i think thats how it will work, just re-wrote it so you can understand a little better, if you couldn't before
_________________
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
|
| Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Wed Feb 06, 2008 6:25 am Post subject: |
|
|
well i just tried to simplifiy the code off that site, i assumed it would work, but i did not test
_________________
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
|
| Back to top |
|
 |
|