source:
trunk/common/string.php
@
940
| Revision 940, 339 bytes checked in by btataroiu@…, 3 years ago (diff) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | // Various string processing functions. |
| 4 | |
| 5 | function starts_with($s, $substr) { |
| 6 | log_assert(is_string($s) && is_string($substr)); |
| 7 | return substr($s, 0, strlen($substr)) == $substr; |
| 8 | } |
| 9 | |
| 10 | function ends_with($s, $substr) { |
| 11 | log_assert(is_string($s) && is_string($substr)); |
| 12 | return substr($s, -strlen($substr)) == $substr; |
| 13 | } |
| 14 | |
| 15 | ?> |
Note: See TracBrowser
for help on using the repository browser.
![[infoarena] development](/chrome/site/logo.png)