[REBOL] Re: Interesting date formatting functions
From: AJMartin:orcon at: 24-Dec-2003 22:50
Didec wrote:
> And so (even if I can suppose what is it) what is the code of the 'pad
func ??
Here's the version I use:
>> source pad
pad: func [
{Pads a value with leading zeroes or trailing spaces or a specified fill
character.}
Value [any-type!] "The value."
Width [integer!] "The desired width."
/With Fill [char!] "With the specified Fill character." /local
Operator][
Operator: either any-string? Value [
any [Fill Fill: #" "] :tail
] [
Value: form Value
any [Fill Fill: #"0"] :head
]
head insert/dup Operator Value Fill Width - length? Value
]
Enjoy!
Andrew J Martin
Speaking in tongues and performing miracles.
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/