Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [Nifty Function of the Day] Pad

From: amicom:sonic at: 15-Aug-2003 6:13

At 01:17 PM 8/15/03 +0200, you wrote:
>You can also write a shorter version of 'pad : > > pad: func [ > "Pads a value with leading zeroes or a specified fill character." > value [string! number!] n [integer!] > /with c [char!] "Optional Fill Character" > ][ > value: form value > head insert/dup value any [all [with c] #"0"] n - length? value > ]
And an even shorter variation: pad: func [ "Pads a value with leading zeroes or a specified fill character." val [string! number!] n [integer!] /with c [char!] "Optional Fill Character" ][ head insert/dup val: form val any [all [with c] #"0"] n - length? val ] Bohdan "Bo" Lechnowsky Lechnowsky Technical Consulting