Sidebar

How can I trim the leading zeros off of the value in PID-3

0 votes
376 views
asked Sep 18, 2013 by gary-t-8719 (14,860 points)
Some clinics pad the patient id with leading zeros and in some cases these leading zeros need to be trimmed off.

1 Answer

0 votes
 
Best answer

Use a regular expression like this:

var pid3 = source.getNode('PID-3');

pid3 = pid3.replaceFirst("^0+(?!$)", ""); // remove leading 0's from pid3

This answer was inspired by stackOverFlow.com.

 

answered Sep 26, 2013 by mike-r-7535 (13,830 points)
selected Dec 17, 2013 by ron-s-6919
...