[fpc-pascal] Something like "Is a number"?

John Coppens john at jcoppens.com
Fri Jul 8 19:39:06 CEST 2005


On Fri, 08 Jul 2005 16:39:05 +0200
Thomas Zastrow <chef at thomas-zastrow.de> wrote:

> Hello,
> 
> I'm converting some strings with "strtoint" into integers. But
> sometimes the string can't be converted to a number. Is there a
> function which takes a string and tells me if it is possible or not to
> convert it into a number? Something like "IsANumber(string)"
> 
You can use val(str, int/real, err)

if err is 0, the string was converted to an integer or real (depending on
the type of int/real.

John




More information about the fpc-pascal mailing list