https://wiki.bennugd.org/index.php?title=Rpad&feed=atom&action=history
Rpad - Revision history
2024-03-28T12:16:52Z
Revision history for this page on the wiki
MediaWiki 1.36.2
https://wiki.bennugd.org/index.php?title=Rpad&diff=6769&oldid=prev
Sandman at 13:55, 9 March 2009
2009-03-09T13:55:10Z
<p></p>
<p><b>New page</b></p><div>[[Category:functions]]<br />
[[Category:strings]]<br />
[[Category:mod_string]]<br />
<br />
==Definition==<br />
'''STRING''' rpad( <'''STRING''' str> , <'''INT''' length> )<br />
<br />
Returns the string ''str'', padding (adding spaces to) the back of the string if needed to make ''str'' of length ''length''. The original string will remain unchanged.<br />
<br />
If ''length'' is smaller or equal to the length of ''str'', the returned string is ''str''.<br />
<br />
== Parameters ==<br />
{| <br />
| '''STRING''' str || - The string to pad (add spaces to).<br />
|-<br />
| '''INT''' length|| - The minimal length of the returned string.<br />
|}<br />
<br />
== Returns ==<br />
'''STRING''': padded string<br />
<br />
== Example ==<br />
<pre><br />
import "mod_string"<br />
import "mod_say"<br />
<br />
Process Main()<br />
Private<br />
string ABC = "ABC";<br />
string _ABC;<br />
string ABC__;<br />
Begin<br />
<br />
ABC = lpad(ABC,2);<br />
_ABC = lpad(ABC,4);<br />
ABC__ = rpad(ABC,5);<br />
<br />
say('ABC = "' + ABC + '"');<br />
say('_ABC = "' + _ABC + '"');<br />
say('ABC__ = "' + ABC__ + '"');<br />
<br />
End<br />
</pre><br />
Used in example: [[say]](), [[lpad]](), [[rpad]]()<br />
<br />
Result:<br />
<pre><br />
ABC = "ABC"<br />
_ABC = " ABC"<br />
ABC__ = "ABC "<br />
</pre><br />
<br />
{{Moduledocbox<br />
| module = Mod_string<br />
}}</div>
Sandman