pad_head

Definition: sequence target = pad_head(sequence target, integer size, object ch=' ')
Description: Pad the beginning of a sequence with an object so as to meet a minimum length condition.

target: the sequence to pad.
size: the minimum length of the result.
ch: the object to pad with, usually a character (defaults to a space).

Returns either target if it was already long enough, or extended to be of length size by inserting the required number of elements at the start.
Comments: pad_head() does not remove characters. The target and result need not necessarily be the same.
If length(target) is greater than or equal to size, this function simply returns target unaltered.
See head() if you wish to truncate long sequences.
Example:
s = pad_head("ABC", 6)              -- s is "   ABC"
s = pad_head("ABC", 6, '-')         -- s is "---ABC"