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

Added longestCommonSubstring

This commit is contained in:
Daniel St. Jules
2013-07-27 02:47:58 -04:00
parent aeef5493c0
commit 332ceb4224
6 changed files with 107 additions and 8 deletions

View File

@@ -37,6 +37,7 @@ Note: The methods listed below are subject to change until we reach a 1.0.0 rele
* [shuffle](#shuffle)
* [longestCommonPrefix](#longestcommonprefix)
* [longestCommonSuffix](#longestcommonsuffix)
* [longestCommonSubstring](#longestcommonsubstring)
* [Tests](#tests)
* [License](#license)
@@ -543,9 +544,21 @@ S::create('fòô bàř', 'UTF-8')->longestCommonSuffix('fòr bàř');
S::longestCommonSuffix('fòô bàř', 'fòr bàř', 'UTF-8'); // ' bàř'
```
## TODO
##### longestCommonSubstring
**longestCommonSubstring**
$stringy->longestCommonSubstring(string $otherString)
S::longestCommonSubstring(string $str, string $otherString [, $encoding ])
Finds the longest common substring between $str and $otherString. In the
case of ties, returns that which occurs first.
```php
S::create('foo bar')->longestCommonSubstring('boo far');
S::longestCommonSubstring('foo bar', 'boo far'); // 'oo '
```
## TODO
**count** => substr_count