Copy link to clipboard
Copied
Hello,
I am currently using this script to truncate decimals into an integer:
event.value = event.value.toString().replace(/(^.*\.\d{0}).*$/,"$1");
This is a minor request, but how can I modify this script so that the decimal point does not appear at the end?
Example of current result: 36.
Example of desired result: 36
Any other guidance for formatting script to "drop" decimals is also appreciated! Thank you in advance.
Copy link to clipboard
Copied
There are many different ways to modify decimal numbers. From mathematical rounding to text manipulation.
If all you want to do is to remove the decimal, then use the Math.floor() function.
event.value = Math.floor(event.value);
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
There are many different ways to modify decimal numbers. From mathematical rounding to text manipulation.
If all you want to do is to remove the decimal, then use the Math.floor() function.
event.value = Math.floor(event.value);
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Exactly what I needed. Thank you so much, Thom!

