Re: Standard toolkit

new topic     » goto parent     » topic index » view thread      » older message » newer message

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".
--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu