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: AJMartin:orcon at: 17-Aug-2003 8:45

Or one that switches around the fill character depending upon the value's type: Pad: function [ "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." ] [ Operator ] [ Operator: either any-string? Value [ any [Fill Fill: #" "] :tail ] [ any [Fill Fill: #"0"] :head ] head insert/dup Operator Value: form Value Fill Width - length? Value ] Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/