Solved

ZPL/ INPUT numeric value to string

  • 17 May 2022
  • 1 reply
  • 476 views

Userlevel 1

How does one convert the numeric value obtained from user INPUT to STRING data type?

Thanks

icon

Best answer by MichaelH 17 May 2022, 19:18

View original

1 reply

Userlevel 6
Badge +2

Hi Asuku,

To convert a value to a string, you should use $STR(val).  This will use the currently defined FORMAT keyword, so if you want to convert to an integer, double, or scientific notation, you will need to use the FORMAT before $STR(val).

Likewise, if you want to convert a string to a numeric value, you can use either SVAL(str$) or LVAL(str$) (SVAL will use a period as a decimal separator while LVAL will use the locally defined character as the decimal separator).

Reply