Fix zero padding in $Number$ replacement for SegmentTemplate. Fully fixes issue #32

Further to all the comments on issue #32, I am submitting this patch which I think provides a complete solution to that issue.

All of our test assets use this template substitution, as well as each of the trials we have run, so it is really important to us that this functionality is available.

Based on a patch originally provided by @dtvltim so props to him.