The Modular DocBook Stylesheets | ||
---|---|---|
Prev | DSSSL Library | Next |
(pad-string string length padchar)
Returns string, padded in front with padchar to at least length Returns string unmodified if string is not a (string?), padchar is not a (string?), padchar is the empty string, or if string is already greater than or equal to length in length.
The string to pad.
The desired length.
The character (string, actually) to use as padding. If padchar is longer than 1 character, the resulting string may be longer than length when returned.
Norman Walsh, <norm@berkshire.net>
(define (pad-string string length padchar) ;; Pads a string, in front, to the specified length (if (and (string? string) (string? padchar) (> (string-length padchar) 0)) (let loop ((s string) (count (- length (string-length string)))) (if (<= count 0) s (loop (string-append padchar s) (- count (string-length padchar))))) string))
Prev | Home | Next |
nth-node | Up | parse-measurement |
Copyright © 1997, 1998 Norman Walsh