/
ColdC/Functions/
ColdC/Structure/
<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)
=&gt; "foo   "

pad("foobar", 3)
=&gt; "foo"

pad(tostr(29), -4, "0")
=&gt; "0029"

pad("what", 20, "!?!")
=&gt; "what!?!!?!!?!!?!!?!!"
</PRE>
</blockquote>

<p><hr size=4><p align=center><i>Last Modified on 24 Mar 1996</i>
<br><i>Copyright &copy; 1995, 1996, Brandon Gillespie</i>
</body>