javascript - Utilities.formatString() New Apps Script method, not working as intended -


i using new method: utilities.formatstring()

in google documentation says similar sprintf %-style.

i searched , read this article sprintf in php.

i cannot seem work intended. meant pad 8 character string 4 leading zeros. know there other ways this, trying handle on sprintf / formatstring thing.

var noformat = "12345678"; var formatted = utilities.formatstring("%012s", noformat); 

i expected var formatted equal "000012345678". debugger tell me formatted = 0, or throws error..

i confused.

try :

function xxx(){   var noformat = '12345678'   var formatted = utilities.formatstring("%012d", noformat); logger.log(formatted) } 

the different parameters can used easy find on web, here example explains how argument must evaluated in php usage same.

logger result :

enter image description here


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -