faqts : Computers : Programming : Languages : Delphi

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

17 of 25 people (68%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

Delphi: String: Convert: Math: Double: How to convert a string to a double?

Nov 29th, 2003 18:03
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 11 October 2003 - 07:19 am --------------------

Delphi: String: Convert: Math: Double: How to convert a string to a 
double?

---

Steps: Overview:

 1. -Use StrToFloat to convert the string to a double

 2. -Cast the result to a double

---

e.g.

// library: string: convert a string to a double [kn, ni, fr, 10-10-
2003 19:50:37]
// 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;

---
---

Internet: see also:

---

Delphi: Convert: Can you give overview of conversions in Delphi? 
[math / string / cast]
http://www.faqts.com/knowledge_base/view.phtml/aid/27008/fid/175

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