Modula-2 || Compiler & Tools || Library || Search Engine


Ulm's Modula-2 Library:
StrToNum


NAME

StrToNum, StrToCard, StrToInt - string to number conversions

SYNOPSIS

PROCEDURE StrToCard(str: ARRAY OF CHAR;
                    VAR card: CARDINAL): BOOLEAN;

PROCEDURE StrToInt(str: ARRAY OF CHAR;
                   VAR integ: INTEGER): BOOLEAN;

DESCRIPTION

StrToCard converts str to the CARDINAL card. Leading blanks, tabs, and newlines are ignored. If str does not fit the syntax, [+] {digit}, or if the resulting number exceeds CARDINAL range, the function value will be FALSE, otherwise TRUE.

StrToInt converts str to the INTEGER integ in analogous manner, where str must fit the syntax: [+|-] {digit} .

SEE ALSO

Conversions

BUGS

If str contains no digit at all, it will be taken for zero.
Edited by: martin, last change: 1996/12/09, revision: 1.2, converted to HTML: 1996/12/11

Modula-2 || Compiler & Tools || Library || Search Engine