Integer.TryParse

Syntax

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

Parameters

Value. String value that is must be converted into 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 Main;

Var

b: Boolean;

i: Integer;

s: String;

Begin

s := "234";

b := Integer.TryParse(s, i);

End Sub Main;

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

See also:

Integer