mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-11 15:54:04 +02:00
Add changelog, make few small doc corrections
This commit is contained in:
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### 1.0.0-rc.1 (2013-07-28)
|
||||
|
||||
* Release candidate
|
18
README.md
18
README.md
@@ -6,8 +6,6 @@ A PHP library with a variety of string manipulation functions with multibyte sup
|
||||
[](https://packagist.org/packages/danielstjules/stringy)
|
||||
[](https://packagist.org/packages/danielstjules/stringy)
|
||||
|
||||
Note: The methods listed below are subject to change until we reach a 1.0.0 release.
|
||||
|
||||
* [Requiring/Loading](#requiringloading)
|
||||
* [OO and Procedural](#oo-and-procedural)
|
||||
* [Methods](#methods)
|
||||
@@ -175,7 +173,7 @@ Returns true if $haystack contains $needle, false otherwise.
|
||||
|
||||
```php
|
||||
S::create('Ο συγγραφέας είπε', 'UTF-8')->contains('συγγραφέας');
|
||||
S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8') // true
|
||||
S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8'); // true
|
||||
```
|
||||
|
||||
#### count
|
||||
@@ -189,7 +187,7 @@ mb_substr_count()
|
||||
|
||||
```php
|
||||
S::create('Ο συγγραφέας είπε', 'UTF-8')->count('α');
|
||||
S::count('Ο συγγραφέας είπε', 'α', 'UTF-8') // 2
|
||||
S::count('Ο συγγραφέας είπε', 'α', 'UTF-8'); // 2
|
||||
```
|
||||
|
||||
#### create
|
||||
@@ -542,7 +540,7 @@ Replaces all occurrences of $search with $replace in $str.
|
||||
|
||||
```php
|
||||
S::create('fòô bàř fòô bàř', 'UTF-8')->replace('fòô ', '');
|
||||
S::replace('fòô bàř fòô bàř', 'fòô ', '', 'UTF-8') // 'bàř bàř'
|
||||
S::replace('fòô bàř fòô bàř', 'fòô ', '', 'UTF-8'); // 'bàř bàř'
|
||||
```
|
||||
|
||||
#### reverse
|
||||
@@ -585,7 +583,7 @@ in a string.
|
||||
|
||||
```php
|
||||
S::create('fòô bàř', 'UTF-8')->shuffle();
|
||||
S::shuffle('fòô bàř', 'UTF-8') // 'àôřb òf'
|
||||
S::shuffle('fòô bàř', 'UTF-8'); // 'àôřb òf'
|
||||
```
|
||||
|
||||
#### slugify
|
||||
@@ -601,7 +599,7 @@ dashes. The string is also converted to lowercase.
|
||||
|
||||
```php
|
||||
S::create('Using strings like fòô bàř')->slugify();
|
||||
S::slugify('Using strings like fòô bàř') // 'using-strings-like-foo-bar'
|
||||
S::slugify('Using strings like fòô bàř'); // 'using-strings-like-foo-bar'
|
||||
```
|
||||
|
||||
#### standardize
|
||||
@@ -716,7 +714,7 @@ $tabLength. By default, each tab is converted to 4 consecutive spaces.
|
||||
|
||||
```php
|
||||
S::create(' String speech = "Hi"')->toSpaces();
|
||||
S::toSpaces(' String speech = "Hi"') // ' String speech = "Hi"'
|
||||
S::toSpaces(' String speech = "Hi"'); // ' String speech = "Hi"'
|
||||
```
|
||||
|
||||
#### toTabs
|
||||
@@ -731,7 +729,7 @@ converted to a tab.
|
||||
|
||||
```php
|
||||
S::create(' fòô bàř')->toTabs();
|
||||
S::toTabs(' fòô bàř') // ' fòô bàř'
|
||||
S::toTabs(' fòô bàř'); // ' fòô bàř'
|
||||
```
|
||||
|
||||
#### trim
|
||||
@@ -744,7 +742,7 @@ Trims $str. An alias for PHP's trim() function.
|
||||
|
||||
```php
|
||||
S::create('fòô bàř', 'UTF-8')->trim();
|
||||
S::trim(' fòô bàř ') // 'fòô bàř'
|
||||
S::trim(' fòô bàř '); // 'fòô bàř'
|
||||
```
|
||||
|
||||
#### truncate
|
||||
|
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "danielstjules/stringy",
|
||||
"description": "A small string manipulation library with multibyte support",
|
||||
"description": "A string manipulation library with multibyte support",
|
||||
"keywords": [
|
||||
"multibyte", "string", "manipulation", "utility", "methods", "utf-8",
|
||||
"helpers", "utils"
|
||||
"helpers", "utils", "utf"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
|
@@ -585,8 +585,8 @@ class StaticStringy
|
||||
/**
|
||||
* Returns true if $str contains only alphabetic chars, false otherwise.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains only alphabetic chars
|
||||
*/
|
||||
public static function isAlpha($str, $encoding = null)
|
||||
@@ -598,8 +598,8 @@ class StaticStringy
|
||||
* Returns true if $str contains only alphabetic and numeric chars, false
|
||||
* otherwise.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains only alphanumeric chars
|
||||
*/
|
||||
public static function isAlphanumeric($str, $encoding = null)
|
||||
@@ -610,8 +610,8 @@ class StaticStringy
|
||||
/**
|
||||
* Returns true if $str contains only whitespace chars, false otherwise.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains only whitespace characters
|
||||
*/
|
||||
public static function isBlank($str, $encoding = null)
|
||||
@@ -622,8 +622,8 @@ class StaticStringy
|
||||
/**
|
||||
* Returns true if $str contains only lower case chars, false otherwise.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains only lower case characters
|
||||
*/
|
||||
public static function isLowerCase($str, $encoding = null)
|
||||
@@ -634,8 +634,8 @@ class StaticStringy
|
||||
/**
|
||||
* Returns true if $str contains only upper case chars, false otherwise.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains only upper case characters
|
||||
*/
|
||||
public static function isUpperCase($str, $encoding = null)
|
||||
|
@@ -190,7 +190,7 @@ class Stringy
|
||||
* Also accepts an array, $ignore, allowing you to list words not to be
|
||||
* capitalized.
|
||||
*
|
||||
* @param array $ignore An array of words not to capitalize
|
||||
* @param array $ignore An array of words not to capitalize
|
||||
* @return Stringy Object with a titleized $str
|
||||
*/
|
||||
public function titleize($ignore = null)
|
||||
@@ -390,8 +390,8 @@ class Stringy
|
||||
* Pads $str to a given length from the begining of the string.
|
||||
* Alias for pad($length, $padStr, 'left')
|
||||
*
|
||||
* @param int $length Desired string length after padding
|
||||
* @param string $padStr String used to pad, defaults to space
|
||||
* @param int $length Desired string length after padding
|
||||
* @param string $padStr String used to pad, defaults to space
|
||||
* @return Stringy Object with a left padded $str
|
||||
*/
|
||||
public function padLeft($length, $padStr = ' ')
|
||||
@@ -403,8 +403,8 @@ class Stringy
|
||||
* Pads $str to a given length from the end of the string.
|
||||
* Alias for pad($length, $padStr, 'left')
|
||||
*
|
||||
* @param int $length Desired string length after padding
|
||||
* @param string $padStr String used to pad, defaults to space
|
||||
* @param int $length Desired string length after padding
|
||||
* @param string $padStr String used to pad, defaults to space
|
||||
* @return string Object with a right padded $str
|
||||
*/
|
||||
public function padRight($length, $padStr = ' ')
|
||||
@@ -416,8 +416,8 @@ class Stringy
|
||||
* Pads $str to a given length such that both sides of the string string are
|
||||
* padded. Alias for pad($str, $length, $padStr, 'both', $encoding)
|
||||
*
|
||||
* @param int $length Desired string length after padding
|
||||
* @param string $padStr String used to pad, defaults to space
|
||||
* @param int $length Desired string length after padding
|
||||
* @param string $padStr String used to pad, defaults to space
|
||||
* @return Stringy The padded string
|
||||
*/
|
||||
public function padBoth($length, $padStr = ' ')
|
||||
@@ -529,7 +529,7 @@ class Stringy
|
||||
/**
|
||||
* Returns true if $str contains $needle, false otherwise.
|
||||
*
|
||||
* @param string $needle Substring to look for
|
||||
* @param string $needle Substring to look for
|
||||
* @return bool Whether or not $str contains $needle
|
||||
*/
|
||||
public function contains($needle)
|
||||
@@ -580,8 +580,8 @@ class Stringy
|
||||
* truncating occurs, the string is further truncated so that the substring
|
||||
* may be appended without exceeding the desired length.
|
||||
*
|
||||
* @param int $length Desired length of the truncated string
|
||||
* @param string $substring The substring to append if it can fit
|
||||
* @param int $length Desired length of the truncated string
|
||||
* @param string $substring The substring to append if it can fit
|
||||
* @return Stringy Object with the resulting $str after truncating
|
||||
*/
|
||||
public function truncate($length, $substring = '')
|
||||
@@ -606,8 +606,8 @@ class Stringy
|
||||
* is further truncated so that the substring may be appended without
|
||||
* exceeding the desired length.
|
||||
*
|
||||
* @param int $length Desired length of the truncated string
|
||||
* @param string $substring The substring to append if it can fit
|
||||
* @param int $length Desired length of the truncated string
|
||||
* @param string $substring The substring to append if it can fit
|
||||
* @return Stringy Object with the resulting $str after truncating
|
||||
*/
|
||||
public function safeTruncate($length, $substring = '')
|
||||
@@ -999,8 +999,8 @@ class Stringy
|
||||
* Returns the number of occurences of $substring in $str. An alias for
|
||||
* mb_substr_count()
|
||||
*
|
||||
* @param string $substring The substring to search for
|
||||
* @return int The number of $substring occurences
|
||||
* @param string $substring The substring to search for
|
||||
* @return int The number of $substring occurences
|
||||
*/
|
||||
public function count($substring)
|
||||
{
|
||||
|
Reference in New Issue
Block a user