diff --git a/README.md b/README.md index 7dfa74e..231559e 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ method in Stringy\StaticStringy. For all others, they're found in Stringy\String ##### create -S->create(string $str, [, $encoding ]) +$stringy = S::create(string $str, [, $encoding ]) Creates a Stringy object and assigns both str and encoding properties the supplied values. If $encoding is not specified, it defaults to @@ -93,6 +93,8 @@ S::create('fòô bàř', 'UTF-8'); // 'fòô bàř' ##### upperCaseFirst +$stringy->upperCaseFirst(); + S::upperCaseFirst(string $str [, string $encoding ]) Converts the first character of the supplied string to upper case, with @@ -105,6 +107,8 @@ S::upperCaseFirst('σ test', 'UTF-8'); // 'Σ test' ##### lowerCaseFirst +$stringy->lowerCaseFirst(); + S::lowerCaseFirst(string $str [, string $encoding ]) Converts the first character of the supplied string to lower case, with @@ -117,6 +121,8 @@ S::lowerCaseFirst('Σ test', 'UTF-8'); // 'σ test' ##### camelize +$stringy->camelize(); + S::camelize(string $str [, string $encoding ]) Returns a camelCase version of a supplied string, with multibyte support. @@ -130,6 +136,8 @@ S::camelize('Camel-Case'); // 'camelCase' ##### upperCamelize +$stringy->upperCamelize(); + S::upperCamelize(string $str [, string $encoding ]) Returns an UpperCamelCase version of a supplied string, with multibyte @@ -143,6 +151,8 @@ S::upperCamelize('Upper Camel-Case'); // 'UpperCamelCase' ##### dasherize +$stringy->dasherize(); + S::dasherize(string $str [, string $encoding ]) Returns a lowercase and trimmed string seperated by dashes, with @@ -157,6 +167,8 @@ S::dasherize('TestDCase'); // 'test-d-case' ##### underscored +$stringy->underscored(); + S::underscored(string $str [, string $encoding ]) Returns a lowercase and trimmed string seperated by underscores, with @@ -171,6 +183,8 @@ S::underscored('TestUCase'); // 'test_u_case' ##### swapCase +$stringy->swapCase(); + S::swapCase(string $str [, string $encoding ]) Returns a case swapped version of a string. @@ -182,6 +196,8 @@ S::swapCase('Ντανιλ', 'UTF-8'); // 'νΤΑΝΙΛ' ##### titleize +$stringy->titleize([ string $encoding ]) + S::titleize(string $str [, array $ignore [, string $encoding ]]) Capitalizes the first letter of each word in a string, after trimming. @@ -198,6 +214,8 @@ S::titleize('i like to watch DVDs at home', $ignore, 'UTF-8'); ##### humanize +$stringy->humanize() + S::humanize(string $str [, string $encoding ]) Capitalizes the first word of a string, replaces underscores with spaces, @@ -210,6 +228,8 @@ S::humanize('author_id'); // 'Author' ##### tidy +$stringy->tidy() + S::tidy(string $str) Replaces smart quotes, ellipsis characters, and dashes from Windows-1252 @@ -222,6 +242,8 @@ S::tidy('“I see…”'); // '"I see..."' ##### collapseWhitespace +$stringy->collapseWhitespace() + S::collapseWhitespace(string $str) Trims the string and replaces consecutive whitespace characters with a @@ -234,6 +256,8 @@ S::collapseWhitespace(' Ο συγγραφέας '); // 'Ο συγγρα ##### standardize +$stringy->standardize() + S::standardize(string $str) Converts some non-ASCII characters to their closest ASCII counterparts. @@ -245,6 +269,8 @@ S::standardize('fòô bàř'); // 'foo bar' ##### pad +$stringy->pad(int $length [, string $padStr = ' ' [, string $padType = 'right' ]]) + S::pad(string $str , int $length [, string $padStr = ' ' [, string $padType = 'right' [, string $encoding ]]]) Pads a string to a given length with another string. If length is less @@ -260,6 +286,8 @@ S::pad('fòô bàř', 10, '¬ø', 'left', 'UTF-8'); // '¬ø¬fòô bàř' ##### padLeft +$stringy->padLeft(int $length [, string $padStr = ' ' ]) + S::padLeft(string $str , int $length [, string $padStr = ' ' [, string $encoding ]]) Returns a new string of a given length such that the beginning of the @@ -272,6 +300,8 @@ S::padLeft('foo bar', 9, ' '); // ' foo bar' ##### padRight +$stringy->padRight(int $length [, string $padStr = ' ' ]) + S::padRight(string $str , int $length [, string $padStr = ' ' [, string $encoding ]]) Returns a new string of a given length such that the end of the string is @@ -284,6 +314,8 @@ S::padRight('foo bar', 10, '_*'); // 'foo bar_*_' ##### padBoth +$stringy->padBoth(int $length [, string $padStr = ' ' ]) + S::padBoth(string $str , int $length [, string $padStr = ' ' [, string $encoding ]]) Returns a new string of a given length such that both sides of the string @@ -296,6 +328,8 @@ S::padBoth('foo bar', 9, ' '); // ' foo bar ' ##### startsWith +$stringy->startsWith(string $substring [, boolean $caseSensitive = true ]) + S::startsWith(string $str, string $substring [, boolean $caseSensitive = true [, string $encoding ]]) Returns true if the string $str begins with $substring, false otherwise. @@ -309,6 +343,8 @@ S::startsWith('FÒÔ bàřs', 'fòô bàř', false, 'UTF-8'); // true ##### endsWith +$stringy->endsWith(string $substring [, boolean $caseSensitive = true ]) + S::endsWith(string $str, string $substring [, boolean $caseSensitive = true [, string $encoding ]]) Returns true if the string $str ends with $substring, false otherwise. @@ -322,6 +358,8 @@ S::endsWith('FÒÔ bàřs', 'àřs', true, 'UTF-8'); // true ##### toSpaces +$stringy->toSpaces([ tabLength = 4 ]) + S::toSpaces(string $str, [, int $tabLength = 4 ]) Converts each tab in a string to some number of spaces, as defined by @@ -334,6 +372,8 @@ S::toSpaces(' String speech = "Hi"') // ' String speech = "Hi"' ##### toTabs +$stringy->toTabs([ tabLength = 4 ]) + S::toTabs(string $str, [, int $tabLength = 4 ]) Converts each occurence of some consecutive number of spaces, as defined @@ -347,6 +387,8 @@ S::toTabs(' fòô bàř') // ' fòô bàř' ##### slugify +$stringy->slugify() + S::slugify(string $str) Converts the supplied text into an URL slug. This includes replacing @@ -361,6 +403,8 @@ S::slugify('Using strings like fòô bàř') // 'using-strings-like-foo-bar' ##### contains +$stringy->contains(string $needle) + S::contains(string $haystack, string $needle [, string $encoding ]) Returns true if $haystack contains $needle, false otherwise. @@ -372,6 +416,8 @@ S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8') ##### surround +$stringy->surround(string $substring) + S::surround(string $str, string $substring) Surrounds a string with the given substring. @@ -383,6 +429,8 @@ S::surround(' ͜ ', 'ʘ'); // 'ʘ ͜ ʘ' ##### insert +$stringy->insert(int $index, string $substring) + S::insert(string $str, int $index, string $substring [, string $encoding ]) Inserts $substring into $str at the $index provided. @@ -394,6 +442,8 @@ S::insert('fòô bà', 'ř', 6, 'UTF-8'); // 'fòô bàř' ##### safeTruncate +$stringy->safeTruncate(int $length, [, string $substring = '' ]) + S::safeTruncate(string $str, int $length, [, string $substring = '' [, string $encoding ]]) Truncates the string to a given length, while ensuring that it does not @@ -408,6 +458,8 @@ S::safeTruncate('What are your plans today?', 22, '...'); // 'What are your pla ##### reverse +$stringy->reverse() + S::reverse(string $str, [, string $encoding ]) Reverses a string. A multibyte version of strrev. @@ -419,6 +471,8 @@ S::reverse('fòô bàř', 'UTF-8'); // 'řàb ôòf' ##### shuffle +$stringy->shuffle() + S::shuffle(string $str [, string $encoding ]) A multibyte str_shuffle function. It randomizes the order of characters @@ -431,6 +485,8 @@ S::shuffle('fòô bàř', 'UTF-8') // 'àôřb òf' ##### trim +$stringy->trim() + S::trim(string $str) Trims $str. An alias for PHP's trim() function.