How it works
TDataTypeConverter has a plethora of methods and works in two directions:
- Pascal Type to Bytes: It takes a standard Pascal type (like integer or string) and converts it into a TUInt8Array (a dynamic array of bytes).
- Bytes to Pascal Type: It takes a TUInt8Array and converts it back into its original Pascal type.
Method |
Description |
Int32ToBytes(Value: int32) |
Converts a 32-bit integer into a 4-byte array. |
Float64ToBytes(Value: float64) |
Converts a 64-bit float (double) into an 8-byte array. |
StringToBytes(Value: string) |
Encodes a string into a TUInt8Array using UTF-8. |
BytesToInt32(Data: TUInt8Array) |
Converts a 4-byte array back into a 32-bit integer. |
BytesToFloat64(Data: TUInt8Array) |
Converts an 8-byte array back into a 64-bit float. |
BytesToString(Data: TUInt8Array) |
Decodes a TUInt8Array from UTF-8 into a string. |