Skip to content

Commit

Permalink
Str::starts_with() and Str::ends_with() added.
Browse files Browse the repository at this point in the history
  • Loading branch information
jyggen committed Aug 22, 2012
1 parent d09fda9 commit 83e7697
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions classes/str.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,115 @@ <h4 class="method" id="method_is_html">is_html($string)</h4>
</table>
</article>

<article>
<h4 class="method" id="method_starts_with">starts_with($str, $start, $ignore_case = false)</h4>
<p>The <strong>starts_with</strong> method checks wether a string has a precific beginning.</p>
<table class="method">
<tbody>
<tr>
<th class="legend">Static</th>
<td>Yes</td>
</tr>
<tr>
<th>Parameters</th>
<td>
<table class="parameters">
<tr>
<th>Param</th>
<th>Default</th>
<th class="description">Description</th>
</tr>
<tr>
<th><kbd>$str</kbd></th>
<td><em>required</em></td>
<td>The string to check.</td>
</tr>
<tr>
<th><kbd>$start</kbd></th>
<td><em>required</em></td>
<td>The beginning to check for.</td>
</tr>
<tr>
<th><kbd>$ignore_case</kbd></th>
<td><pre class="php"><code>false</code></pre></td>
<td>Wether to ignore the case.</td>
</tr>
</table>
</td>
</tr>
<tr>
<th>Returns</th>
<td>bool</td>
</tr>
<tr>
<th>Example</th>
<td>
<pre class="php"><code>$string = "Lorem ipsum dolor sit amet";

Str::starts_with($string, 'Lorem'); // returns true
Str::starts_with($string, 'lorem'); // returns false
Str::starts_with($string, 'lorem', true); // returns true
</code></pre>
</td>
</tr>
</tbody>
</table>
</article>

<article>
<h4 class="method" id="method_ends_with">ends_with($str, $end, $ignore_case = false)</h4>
<p>The <strong>ends_with</strong> method checks wether a string has a precific ending.</p>
<table class="method">
<tbody>
<tr>
<th class="legend">Static</th>
<td>Yes</td>
</tr>
<tr>
<th>Parameters</th>
<td>
<table class="parameters">
<tr>
<th>Param</th>
<th>Default</th>
<th class="description">Description</th>
</tr>
<tr>
<th><kbd>$str</kbd></th>
<td><em>required</em></td>
<td>The string to check.</td>
</tr>
<tr>
<th><kbd>$end</kbd></th>
<td><em>required</em></td>
<td>The ending to check for.</td>
</tr>
<tr>
<th><kbd>$ignore_case</kbd></th>
<td><pre class="php"><code>false</code></pre></td>
<td>Wether to ignore the case.</td>
</tr>
</table>
</td>
</tr>
<tr>
<th>Returns</th>
<td>bool</td>
</tr>
<tr>
<th>Example</th>
<td>
<pre class="php"><code>$string = "Lorem ipsum dolor sit amet";

Str::ends_with($string, 'amet'); // returns true
Str::ends_with($string, 'Amet'); // returns false
Str::ends_with($string, 'Amet', true); // returns true
</code></pre>
</td>
</tr>
</tbody>
</table>
</article>

</div>

Expand Down

0 comments on commit 83e7697

Please sign in to comment.