String to num 1st Zero lost
Posted: Fri Oct 28, 2022 5:33 am
Hello
I found some answer for question below
----------------------------------------------------------:
SteveM ยป Tue Jun 10, 2014
Loosing 1st zero during converstion of num to string
There's no way to do that directly, because the values are stored within the chip as fixed length binary numbers. e.g. if you store your number as a ULONG (4 bytes), it will always be 32bits long inside the chip. When you convert the String to an Integer, any leading zero's in the string will just be ignored, and the chip pads the number with enough 'binary zeros' to fill the bytes.
---------------------
Steve suggested to get the length of the string, however this is OK during the (back) num-to-string conversion.
-------------------
Question
How can I save to integer string "077" without loosing 1st Zero?
Thanks
I found some answer for question below
----------------------------------------------------------:
SteveM ยป Tue Jun 10, 2014
Loosing 1st zero during converstion of num to string
There's no way to do that directly, because the values are stored within the chip as fixed length binary numbers. e.g. if you store your number as a ULONG (4 bytes), it will always be 32bits long inside the chip. When you convert the String to an Integer, any leading zero's in the string will just be ignored, and the chip pads the number with enough 'binary zeros' to fill the bytes.
---------------------
Steve suggested to get the length of the string, however this is OK during the (back) num-to-string conversion.
-------------------
Question
How can I save to integer string "077" without loosing 1st Zero?
Thanks