Re: Standard toolkit
- Posted by Michael Raley <thinkways at yahoo.com> Jul 05, 2005
- 674 views
left and right space padding for strings. This will truncate it if the string length exceeds n, which may not always be desirable... ;
---------------------------------------------<bonus functions> global function Lpad(object s, integer n) --left padded text integer l , comp if atom(s) then s = {s} end if l = length(s) if l<n then comp = n -l s &= repeat(' ',comp) elsif l>n then s = s[1..n] end if return s end function ----------------------------------------------- global function Rpad(object s, integer n) --right padded text integer l , comp l = length(s) if atom(s) then s = {s} end if if l<n then comp = n -l return repeat(' ',comp) & s elsif l>n then s = s[1..n] end if return s end function
--"ask about our layaway plan". --