Page 1 of 1

Adding leading zero

Posted: 05 Apr 2021 01:15
by digitalstone
I'm calculating with hex color values for a progress bar.
And the part where i'm converting the individual RGB values doesn't let me have a '0' as a first character.

For example:
080F00 results in 8F0

I'm using this function to convert decimal to hexadecimal:

Code: Select all

hex = callJavaStaticMethod("java.lang.Integer", "toHexString(int)", newSubCol);
No matter what i do, it either results into errors, or just doesn't give me the leading '0'.

Code: Select all

concat("0", hex)
Doesn't work.

Code: Select all

"0" + hex
Also doesn't work.

Working with 'numberformat' and regex also lead to nothing.


Does anyone know? This is just silly.

Re: Adding leading zero

Posted: 05 Apr 2021 16:18
by digitalstone
Nevermind... i made a rookie mistake -_-

I used this. But i forgot the initialization:

Code: Select all

"{concat("0", hex)}"

Should have been this:

Code: Select all

hex = "{concat("0", hex)}"