### Title

Custom function quirk

### Post

Hi,

I have a function that's meant to pad a number with leading zeroes including numbers with one or more decimals. Here's the function:

Right( "0000000000000000000000" & Number ; If ( Length ( Number ) ≠ Filter ( Number ; "0123456789");Digits+Abs(Length ( Number )- Length ( Filter ( Number ; "0123456789") ) );Digits ) )

//end function

The variables are "number" and "digits" (the total number of digits needed). The function seems to work perfectly. If "digits" is set to 6, 20 evaluates as "000020", .31 to

"0000.31", 23.2.1 to "0023.2.1" etc. In other words, regardless of decimal points (or any non-numeric character) included in the original number, the function retains the decimals but adds the proper number of numeric characters. I was testing this out and found an odd exception. ".2" evaluates as "0000.2" if digits is set to 6, "00000.2" if digits is set to 7. This is odd. .3 works as does every other number I've tried. .20 works. What strikes me as odd is that the function doesn't do numeric evaluation (except for the obvious wrapped in "Abs"). It's primarily a text function. There should be no difference between ".1" and ".2" (in terms of Length)yet they evaluate differently. I may be missing something obvious, and this function may have "limited" utility, but the odd exception intrigues me.

The syntax would be "Pad Zeroes for Decimal Numbers(number;digits) ". In the function, everything from the "If" onwards is an expression of "digits".