Integer.TryParse

Syntax

TryParse(Value: String; Var Result: Integer): Boolean;

Parameters

Value. String value that must be converted to integer type.

Result. Variable, into which the value in case of successful conversion will be placed.

Description

The TryParse method converts a string value into an integer and checks for the string correctness.

Comments

If conversion is successful, the method returns True, and the new value is placed into the variable specified in the Result input parameter.

Example

Sub UserProc;
Var
    b: Boolean;
    i: Integer;
    s: String;
Begin
    s := "234";
    b := Integer.TryParse(s, i);
End Sub UserProc;

After executing this example if the transformation is completed successfully, the "b" variable contains True, and the "i" variable contains the 234 value.

See also:

Integer