padzero(
TEXT
,
WIDTH
)

The padzero( function makes the text a fixed width, padding on the left with zeros if necessary.


Parameters

This function has two parameters:

text – the original text.

width – desired number of characters.


Description

This function makes the text a fixed width. If the text is shorter than the specified width, it is padded with 0s on the left (i.e. the text is right justified). If it is longer than the specified width, it is cut off on the left.

padzero("abcd xyz",12) ☞ 0000abcd xyz
padzero("85.22",7)     ☞ 0085.22

Note: This function is equivalent to:

(rep("0",thewidth)+thetext)[-thewidth,-1]

History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.