Главная страница | назад





Article #16399: Converting AnsiString to numeric variables

 Question and Answer Database

FAQ1399C.txt   Converting AnsiString to numeric variables
Category   :VCL
Platform    :All
Product    :C++Builder  1.x

Question:

   How do you convert AnsiStrings to and from numeric values in 
C++Builder?

Answer:

   Use the built-in functions StrToInst() and StrToFloat convert 
to numeric values and IntToStr() and StrToFloat() for the 
reverse process.

 int intValue = StrToInt(Edit1->Text); //String to Integer double
 double doubleValue = StrToFloat(Edit1->Text);//String to Double

 Edit1->Text = IntToStr(IntValue);         // Integer to String
 Edit1->Text = FloatToStr(doubleValue);    // Double to String

7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99