TryParse(Value: String; Var Result: Int64): Boolean;
Value. The string value that must be converted to the Int64 type.
Result. Variable, into which the value in case of successful conversion will be placed.
The TryParse method converts a string value to the Int64 type with string correction validation.
If conversion is successful, the method returns True, and the converted value is placed to the variable specified in the Result parameter.
Sub SampleInt64;
Var
i: Int64;
b: Boolean;
Begin
b := Int64.TryParse("1234567890", i);
Debug.WriteLine(b.ToString + " : " + i.ToString);
i := 0;
b := Int64.TryParse("1234567890.0", i);
Debug.WriteLine(b.ToString + " : " + i.ToString);
i := 0;
b := Int64.TryParse("1 234 567 890", i);
Debug.WriteLine(b.ToString + " : " + i.ToString);
End Sub SampleInt64;
On executing the example it will be checked if various string values can be converted to the Int64 type. The check and conversion results will be displayed in the development environment console.
See also: