1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-09-02 01:22:37 +02:00

Added lines

This commit is contained in:
Daniel St. Jules
2015-07-25 22:19:36 -07:00
parent cce314f4a5
commit b9cf4b6ae3
3 changed files with 63 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
* [isUpperCase](#isuppercase)
* [last](#last)
* [length](#length)
* [lines](#lines)
* [longestCommonPrefix](#longestcommonprefixstring-otherstr)
* [longestCommonSuffix](#longestcommonsuffixstring-otherstr)
* [longestCommonSubstring](#longestcommonsubstringstring-otherstr)
@@ -525,6 +526,15 @@ Returns the length of the string. An alias for PHP's mb_strlen() function.
s('fòô bàř')->length(); // 7
```
##### lines()
Splits on newlines and carriage returns, returning an array of Stringy
objects corresponding to the lines in the string.
```php
s("fòô\r\nbàř\n")->lines(); // ['fòô', 'bàř', '']
```
##### longestCommonPrefix(string $otherStr)
Returns the longest common prefix between the string and $otherStr.