[REBOL] Re: [Nifty Function of the Day] Pad
From: brian:hawley at: 16-Aug-2003 14:03
At 10:01 AM 8/16/03 -0600, Greg Irwin wrote:
>GI> pad: func [value width /local op] [
>GI> op: either any [number? value money? value date? value] [:head][:tail]
>GI> head insert/dup op value: form value " " width - length? value
>GI> ]
>
>Or maybe this will work for you:
>
>pad: func [value width /local op] [
> op: either any-string? value [:tail][:head]
> head insert/dup op value: form value " " width - length? value
>]
Or maybe this (safer and without locals):
pad: func [value width [number!]] [
head insert/dup
do pick [:tail :head] any-string? :value value: form :value
" " width - length? value
]
- Brian Hawley