` Printed Icetips Article

Icetips Article



Par2: Cast a string to a number using built in type conversions
2001-10-27 -- Carlos Gutierrez
 
An easy way to cast a string to integer is adding 0

CASE StringVar+0
  OF 1
....

Very useful in IFs:

StringVar = '0'
IF StringVar ! Is True
...
IF StringVar+0 !Is False, as expected.
...

Randy Goodhew notes that this will work but creates a REAL, not an
integer.



Printed April 28, 2024, 8:02 pm
This article has been viewed/printed 35112 times.