VARKON Version 1.16 1998-09-04

> ## ival - Function

> String to int conversion
> Description
> Converts a string of characters to an integer value. Leading blanks are ignored but counted together with the number of characters actually used for conversion. If conversion is not possible a value of zero is returned.
> Syntax
> ival(str, status, nchars)

> STRING | str*132;
> INT | status;
> INT | nchars;

> Principal parameters

> str | - The string to convert

> Optional parameters

> status | - 0 => Conversion succsessful, -1 => No conversion possible
> nchars | - Number of characters from str used for conversion

> Return value
> An INT value equal to the converted integer or zero if conversion was unsuccessful.
> Example
> i:=ival(" -12345 ");

> Returns i = -12345.
> i:=ival(" ABC ");

> Returns zero.

> i:=ival("12345",status);

> Retuns i = 12345 and status = 0.

> i:=ival("ABC",status);

> Returns i = 0 and sets status to -1.

> i:=ival("12345 ABC",status,n);

> Returns i = 12345, status = 0 and sets n to 5.

> See also

> fval() rval()

VARKON Homepage | Index