<head><title>ColdC: Function/Method Reference: pad()</title></head> <body> <h1 align=center><a href="/ColdC/">ColdC</a>: <a href="/ColdC/Functions/">Function/Method Reference</a>: pad()</h1> <hr> <p> <font size=+1><i>STRING</i> <b>pad</b>(<i>STRING <b>str</b>, INTEGER <b>length</b>[, STRING <b>filler</b>]</i>)</font> <p>This function pads or truncates <VAR>string</VAR> to the length <VAR>length</VAR>. If <VAR>filler</VAR> is specified, then it is used to pad the string, otherwise a space is used. If <VAR>length</VAR> is greater than the length of <VAR>string</VAR>, then <VAR>pad</VAR> adds filler characters on the right; however, you can force <VAR>pad</VAR> to add filler on the left by specifying <VAR>length</VAR> as a negative number. <p>Examples: <blockquote> <PRE> pad("foo", 6) => "foo " pad("foobar", 3) => "foo" pad(tostr(29), -4, "0") => "0029" pad("what", 20, "!?!") => "what!?!!?!!?!!?!!?!!" </PRE> </blockquote> <p><hr size=4><p align=center><i>Last Modified on 24 Mar 1996</i> <br><i>Copyright © 1995, 1996, Brandon Gillespie</i> </body>