/
ColdC/Functions/
ColdC/Structure/
<head><title>ColdC: Function/Method Reference: substr()</title></head>

<body>

<h1 align=center><a href="/ColdC/">ColdC</a>: <a href="/ColdC/Functions/">Function/Method Reference</a>: substr()</h1>

<hr>

<p>
<font size=+1><i>STRING</i> <b>substr</b>(<i>STRING <b>str</b>, INTEGER <b>start</b>[, INTEGER <b>length</b>]</i>)</font>

<p>This function returns a subrange of <VAR>string</VAR>.  The subrange
starts at the character specified by <var>start</var> and continues
<var>length</var> characters.  If <var>length</var> is unspecified it
continues to the end of the string.  If <var>start</var> is outside of
the range of the string, or <var>length</var> will extend past the end
of the string, the error <code>~range</code> is thrown.

<P>Examples:

<blockquote>
<PRE>
substr("foobar", 2, 3)
=&gt; "oob"

substr("foobar", 3)
=&gt; "obar"

substr("foobar", 7)
=&gt; ""
</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>