display 0 - 9 as double digits

jemfiner's icon

Is there a way to make number display 0 - 9 as double digits. . . eg 00, 01 . . . ?

monetus's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This can be a little hard to navigate to in the docs when you are looking for it, and the documentation relies upon knowledge of other languages. You have to set the unit style attribute to custom, and then format your range with a reference(s). So your custom format would be 0%d. 0=the padding you wanted. %=reference, a 'look for this' tag. d= decimal(?), might be digit. I forget

jemfiner's icon

Thanks, that's great help . . . still not quite there though as I don't want numbers from 10 onwards to display with a leading zero. e.g. I'd like 10 to read as 10, not as 010 !

number doesn't appear to have the Unit Style option . . . is this the case or am I looking in the wrong place ?

Thanks again,

Jem

jemfiner's icon

Brilliant ! Sorry, you did write that ! solved, thanks very much,

Jem

Vigilance Brandon's icon

is there a way to do this with comment boxes? i.e., I'd like to display a couple timestamps in hh:mm:ss format in a comment box, but unfortunately the translate object does not use this "leading zero" format. Just wondering if it is possible to tell some object along the way to add a leading zero for single digits in the hh:mm:ss part

Source Audio's icon

use sprintf %02d:%02d:%02d for that
or combine with padding argument set.