Data Conversions
Function | Conversion Description |
Example
|
IntToStr(value) | Converts an Integer to a String | EditBox1->Text = "count " + IntToStr(count); |
StrToInt(string) | Converts a String to an Integer | count = StrToInt(EditBox1->Text); |
IntToHex(value, digits) | Converts an Integer to a Hexadecimal String in the form 00BBGGRR | EditBoxRed->Text = IntToHex(color, 8); |
FloatToStr(value) | Converts a Float to a String | EditBox1->Text = "gpa " + FloatToStr(gpa); |
StrToFloat(string) | Converts a String to a Float | perCent = StrToFloat(EditBoxPerCent->Text); |
DateToStr(Date()) | Converts a Date to a String | Label1->Caption = DateToStr(Date()); |
TimeToStr(Time()) | Converts a Time to a String | Label1->Caption = TimeToStr(Time()); |
static_cast<int>(anyFloat); | Converts a Float to an Integer | To convert a float into an integer to index an array |
static_cast<float>(anyInteger); | Converts an Integer to a Float | To preserve a division: integer 3/2 does not equal float 3/2 |