Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


string to double ? (delphi)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Wed Feb 06, 2008 1:10 am    Post subject: string to double ? (delphi) Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

Joined: 09 May 2003
Posts: 25974
Location: The netherlands

PostPosted: Wed Feb 06, 2008 3:32 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Wed Feb 06, 2008 5:01 am    Post subject: Reply with quote

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
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Wed Feb 06, 2008 6:00 am    Post subject: Reply with quote

Snootae wrote:

TheString : string;
DoubledString : Double;
begin
DoubledString := StrToFloat (TheString);
end;


DoubledString : Double;
this will give error in delphi .. it should be single

btw thanks darkbyte Smile

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Wed Feb 06, 2008 6:25 am    Post subject: Reply with quote

well i just tried to simplifiy the code off that site, i assumed it would work, but i did not test
_________________
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Wed Feb 06, 2008 7:32 am    Post subject: Reply with quote

Snootae wrote:
well i just tried to simplifiy the code off that site, i assumed it would work, but i did not test


okay thansk anyway Razz it is just that delphi use single instead of double Wink (not always thought ...)

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites