How can i make it so webCoRE doesn’t remove the preceding zero? Please help. I need the zero to setcode on my lock.
Need a zero in front of an integar
Integers do not retain leading zeroes since they have no numerical significance. If you’re working with zip codes your variable type will need to be a string to which you can sign that value with no trouble.
I’m working with a lock. The lock expects an integar parameter to set the code. I need the preceding zero for the code I’m trying to set.
Sorry, if the lock requires an integer and does not automatically add the leading zero you can’t use a code with a leading zero.
webCoRE doesn’t have many limitations but this sure is one. There should be a way i can format the number to have it if needed. There’s several use cases where there would be a leading zero. Birthdays, zip codes, phone numbers…
This is a programming limitation; if you’re formatting a number that is taking a number and displaying it as a string. webCoRE offers many ways to do that, but the formatted value is no longer an integer.
In many programming languages a leading zero suggests that the number is in a different base number system. In Groovy, the 0 in the integer 0123 signifies that the number is octal (i.e. base 8 rather than base 10). The base 8 number 0123 is equivalent to the decimal number 83. You can see why this would result in unexpected behavior for your purposes.
You may consider contacting the developer of the device handler for this lock to identify the problem and recommend accepting codes as strings so that leading zeroes are supported.
Apparently it accepts strings as i used it that way and it set it. I figured it wasn’t the device because i can add the leading zero in any other smart app