Skip to main content
Known Participant
February 19, 2016
Resuelto

How do I script to have a number like 12.25

  • February 19, 2016
  • 1 respuesta
  • 342 visualizaciones

How do I script to have a number always with 2 characters left then dot then 2 decimal places

12.25

10.45

12.50

etc...

Thanks

Este tema ha sido cerrado para respuestas.
Mejor respuesta de George_Johnson

You can use the util.printf method, for example:

var num = 123.456789;

var num_rounded = util.printf("%.2f", num);  // results in 123.46

More information is in the Acrobat JavaScript reference.

1 respuesta

Inspiring
February 19, 2016

You can use the util.printf method, for example:

var num = 123.456789;

var num_rounded = util.printf("%.2f", num);  // results in 123.46

More information is in the Acrobat JavaScript reference.