11![ Stringy] ( http://danielstjules.com/github/stringy-logo.png )
22
33A PHP string manipulation library with multibyte support. Compatible with PHP
4- 5.3+, PHP 7, and HHVM. Refer to the [ 1.x branch] ( https://github.com/danielstjules/Stringy/tree/1.x )
5- for older documentation.
4+ 5.4+, PHP 7, and HHVM.
65
76``` php
87s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
98```
109
10+ Refer to the [ 1.x branch] ( https://github.com/danielstjules/Stringy/tree/1.x ) or
11+ [ 2.x branch] ( https://github.com/danielstjules/Stringy/tree/2.x ) for older
12+ documentation.
13+
1114[ ![ Build Status] ( https://api.travis-ci.org/danielstjules/Stringy.svg?branch=master )] ( https://travis-ci.org/danielstjules/Stringy )
1215[ ![ Total Downloads] ( https://poser.pugx.org/danielstjules/stringy/downloads )] ( https://packagist.org/packages/danielstjules/stringy )
1316[ ![ License] ( https://poser.pugx.org/danielstjules/stringy/license )] ( https://packagist.org/packages/danielstjules/stringy )
@@ -42,7 +45,7 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
4245 </tr>
4346 <tr>
4447 <td>[endsWith](#endswithstring-substring--boolean-casesensitive--true-)</td>
45- <td>[endsWithAny](#endsWithAnystring -substrings--boolean-casesensitive--true-)</td>
48+ <td>[endsWithAny](#endswithanystring -substrings--boolean-casesensitive--true-)</td>
4649 <td>[ensureLeft](#ensureleftstring-substring)</td>
4750 <td>[ensureRight](#ensurerightstring-substring)</td>
4851 </tr>
@@ -74,7 +77,7 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
7477 <td>[isLowerCase](#islowercase)</td>
7578 <td>[isSerialized](#isserialized)</td>
7679 <td>[isUpperCase](#isuppercase)</td>
77- <td>[last](#last )</td>
80+ <td>[last](#lastint-n )</td>
7881 </tr>
7982 <tr>
8083 <td>[length](#length)</td>
@@ -97,7 +100,7 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
97100 <tr>
98101 <td>[removeLeft](#removeleftstring-substring)</td>
99102 <td>[removeRight](#removerightstring-substring)</td>
100- <td>[repeat](#repeatmultiplier )</td>
103+ <td>[repeat](#repeatint-multiplier )</td>
101104 <td>[replace](#replacestring-search-string-replacement)</td>
102105 </tr>
103106 <tr>
@@ -107,10 +110,10 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
107110 <td>[slugify](#slugify-string-replacement----)</td>
108111 </tr>
109112 <tr>
110- <td>[startsWith](#startswithstring-substring--boolean-casesensitive--true-)</td>
111- <td>[startsWithAny](#startswithanystring-substrings--boolean-casesensitive--true-)</td>
112113 <td>[slice](#sliceint-start--int-end-)</td>
113114 <td>[split](#splitstring-pattern--int-limit-)</td>
115+ <td>[startsWith](#startswithstring-substring--boolean-casesensitive--true-)</td>
116+ <td>[startsWithAny](#startswithanystring-substrings--boolean-casesensitive--true-)</td>
114117 </tr>
115118 <tr>
116119 <td>[stripWhitespace](#stripwhitespace)</td>
@@ -121,7 +124,7 @@ s('string')->toTitleCase()->ensureRight('y') == 'Stringy'
121124 <tr>
122125 <td>[tidy](#tidy)</td>
123126 <td>[titleize](#titleize-array-ignore)</td>
124- <td>[toAscii](#toascii)</td>
127+ <td>[toAscii](#toascii-string-locale--en--bool-removeunsupported--true- )</td>
125128 <td>[toBoolean](#toboolean)</td>
126129 </tr>
127130 <tr>
@@ -433,7 +436,7 @@ default, the comparison is case-sensitive, but can be made insensitive by
433436setting $caseSensitive to false.
434437
435438``` php
436- s('fòôbàř')->endsWith('bàř', true ); // true
439+ s('fòôbàř')->endsWith('bàř'); // true
437440```
438441
439442##### endsWithAny(string[ ] $substrings [ , boolean $caseSensitive = true ] )
@@ -443,7 +446,7 @@ By default, the comparison is case-sensitive, but can be made insensitive
443446by setting $caseSensitive to false.
444447
445448``` php
446- s('fòôbàř')->endsWith (['bàř', 'baz'], true ); // true
449+ s('fòôbàř')->endsWithAny (['bàř', 'baz']); // true
447450```
448451
449452##### ensureLeft(string $substring)
@@ -818,26 +821,6 @@ is also converted to lowercase.
818821s('Using strings like fòô bàř')->slugify(); // 'using-strings-like-foo-bar'
819822```
820823
821- ##### startsWith(string $substring [ , boolean $caseSensitive = true ] )
822-
823- Returns true if the string begins with $substring, false otherwise.
824- By default, the comparison is case-sensitive, but can be made insensitive
825- by setting $caseSensitive to false.
826-
827- ``` php
828- s('FÒÔbàřbaz')->startsWith('fòôbàř', false); // true
829- ```
830-
831- ##### startsWithAny(string[ ] $substrings [ , boolean $caseSensitive = true ] )
832-
833- Returns true if the string begins with any of $substrings, false
834- otherwise. By default the comparison is case-sensitive, but can be made
835- insensitive by setting $caseSensitive to false.
836-
837- ``` php
838- s('FÒÔbàřbaz')->startsWith(['fòô', 'bàř'], false); // true
839- ```
840-
841824##### slice(int $start [ , int $end ] )
842825
843826Returns the substring beginning at $start, and up to, but not including
@@ -859,6 +842,26 @@ results.
859842s('foo,bar,baz')->split(',', 2); // ['foo', 'bar']
860843```
861844
845+ ##### startsWith(string $substring [ , boolean $caseSensitive = true ] )
846+
847+ Returns true if the string begins with $substring, false otherwise.
848+ By default, the comparison is case-sensitive, but can be made insensitive
849+ by setting $caseSensitive to false.
850+
851+ ``` php
852+ s('FÒÔbàřbaz')->startsWith('fòôbàř', false); // true
853+ ```
854+
855+ ##### startsWithAny(string[ ] $substrings [ , boolean $caseSensitive = true ] )
856+
857+ Returns true if the string begins with any of $substrings, false
858+ otherwise. By default the comparison is case-sensitive, but can be made
859+ insensitive by setting $caseSensitive to false.
860+
861+ ``` php
862+ s('FÒÔbàřbaz')->startsWithAny(['fòô', 'bàř'], false); // true
863+ ```
864+
862865##### stripWhitespace()
863866
864867Strip all whitespace characters. This includes tabs and newline
@@ -916,14 +919,19 @@ s('i like to watch television')->titleize($ignore);
916919// 'I Like to Watch Television'
917920```
918921
919- ##### toAscii()
922+ ##### toAscii([ , string $locale = 'en' [ , bool $removeUnsupported = true ]] )
920923
921924Returns an ASCII version of the string. A set of non-ASCII characters are
922925replaced with their closest ASCII counterparts, and the rest are removed
923- unless instructed otherwise.
926+ by default. The language or locale of the source string can be supplied
927+ for language-specific transliteration in any of the following formats:
928+ en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping
929+ to "aeoeue" rather than "aou" as in other languages.
924930
925931``` php
926932s('fòôbàř')->toAscii(); // 'foobar'
933+ s('äöü')->toAscii(); // 'aou'
934+ s('äöü')->toAscii('de'); // 'aeoeue'
927935```
928936
929937##### toBoolean()
0 commit comments