1
0
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:
Daniel St. Jules
2013-07-28 23:39:20 -04:00
parent b1cdc7603f
commit 918bdc9839
5 changed files with 37 additions and 36 deletions

3
CHANGELOG.md Normal file
View File

@@ -0,0 +1,3 @@
### 1.0.0-rc.1 (2013-07-28)
* Release candidate

View File

@@ -6,8 +6,6 @@ A PHP library with a variety of string manipulation functions with multibyte sup
[![Total Downloads](https://poser.pugx.org/danielstjules/Stringy/downloads.png)](https://packagist.org/packages/danielstjules/stringy) [![Total Downloads](https://poser.pugx.org/danielstjules/Stringy/downloads.png)](https://packagist.org/packages/danielstjules/stringy)
[![Latest Stable Version](https://poser.pugx.org/danielstjules/Stringy/v/stable.png)](https://packagist.org/packages/danielstjules/stringy) [![Latest Stable Version](https://poser.pugx.org/danielstjules/Stringy/v/stable.png)](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) * [Requiring/Loading](#requiringloading)
* [OO and Procedural](#oo-and-procedural) * [OO and Procedural](#oo-and-procedural)
* [Methods](#methods) * [Methods](#methods)
@@ -175,7 +173,7 @@ Returns true if $haystack contains $needle, false otherwise.
```php ```php
S::create('Ο συγγραφέας είπε', 'UTF-8')->contains('συγγραφέας'); S::create('Ο συγγραφέας είπε', 'UTF-8')->contains('συγγραφέας');
S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8') // true S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8'); // true
``` ```
#### count #### count
@@ -189,7 +187,7 @@ mb_substr_count()
```php ```php
S::create('Ο συγγραφέας είπε', 'UTF-8')->count('α'); S::create('Ο συγγραφέας είπε', 'UTF-8')->count('α');
S::count('Ο συγγραφέας είπε', 'α', 'UTF-8') // 2 S::count('Ο συγγραφέας είπε', 'α', 'UTF-8'); // 2
``` ```
#### create #### create
@@ -542,7 +540,7 @@ Replaces all occurrences of $search with $replace in $str.
```php ```php
S::create('fòô bàř fòô bàř', 'UTF-8')->replace('fòô ', ''); 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 #### reverse
@@ -585,7 +583,7 @@ in a string.
```php ```php
S::create('fòô bàř', 'UTF-8')->shuffle(); S::create('fòô bàř', 'UTF-8')->shuffle();
S::shuffle('fòô bàř', 'UTF-8') // 'àôřb òf' S::shuffle('fòô bàř', 'UTF-8'); // 'àôřb òf'
``` ```
#### slugify #### slugify
@@ -601,7 +599,7 @@ dashes. The string is also converted to lowercase.
```php ```php
S::create('Using strings like fòô bàř')->slugify(); 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 #### standardize
@@ -716,7 +714,7 @@ $tabLength. By default, each tab is converted to 4 consecutive spaces.
```php ```php
S::create(' String speech = "Hi"')->toSpaces(); S::create(' String speech = "Hi"')->toSpaces();
S::toSpaces(' String speech = "Hi"') // ' String speech = "Hi"' S::toSpaces(' String speech = "Hi"'); // ' String speech = "Hi"'
``` ```
#### toTabs #### toTabs
@@ -731,7 +729,7 @@ converted to a tab.
```php ```php
S::create(' fòô bàř')->toTabs(); S::create(' fòô bàř')->toTabs();
S::toTabs(' fòô bàř') // ' fòô bàř' S::toTabs(' fòô bàř'); // ' fòô bàř'
``` ```
#### trim #### trim
@@ -744,7 +742,7 @@ Trims $str. An alias for PHP's trim() function.
```php ```php
S::create('fòô bàř', 'UTF-8')->trim(); S::create('fòô bàř', 'UTF-8')->trim();
S::trim(' fòô bàř ') // 'fòô bàř' S::trim(' fòô bàř '); // 'fòô bàř'
``` ```
#### truncate #### truncate

View File

@@ -1,9 +1,9 @@
{ {
"name": "danielstjules/stringy", "name": "danielstjules/stringy",
"description": "A small string manipulation library with multibyte support", "description": "A string manipulation library with multibyte support",
"keywords": [ "keywords": [
"multibyte", "string", "manipulation", "utility", "methods", "utf-8", "multibyte", "string", "manipulation", "utility", "methods", "utf-8",
"helpers", "utils" "helpers", "utils", "utf"
], ],
"license": "MIT", "license": "MIT",
"authors": [ "authors": [

View File

@@ -585,8 +585,8 @@ class StaticStringy
/** /**
* Returns true if $str contains only alphabetic chars, false otherwise. * Returns true if $str contains only alphabetic chars, false otherwise.
* *
* @param string $str String to check * @param string $str String to check
* @param string $encoding The character encoding * @param string $encoding The character encoding
* @return bool Whether or not $str contains only alphabetic chars * @return bool Whether or not $str contains only alphabetic chars
*/ */
public static function isAlpha($str, $encoding = null) public static function isAlpha($str, $encoding = null)
@@ -598,8 +598,8 @@ class StaticStringy
* Returns true if $str contains only alphabetic and numeric chars, false * Returns true if $str contains only alphabetic and numeric chars, false
* otherwise. * otherwise.
* *
* @param string $str String to check * @param string $str String to check
* @param string $encoding The character encoding * @param string $encoding The character encoding
* @return bool Whether or not $str contains only alphanumeric chars * @return bool Whether or not $str contains only alphanumeric chars
*/ */
public static function isAlphanumeric($str, $encoding = null) public static function isAlphanumeric($str, $encoding = null)
@@ -610,8 +610,8 @@ class StaticStringy
/** /**
* Returns true if $str contains only whitespace chars, false otherwise. * Returns true if $str contains only whitespace chars, false otherwise.
* *
* @param string $str String to check * @param string $str String to check
* @param string $encoding The character encoding * @param string $encoding The character encoding
* @return bool Whether or not $str contains only whitespace characters * @return bool Whether or not $str contains only whitespace characters
*/ */
public static function isBlank($str, $encoding = null) public static function isBlank($str, $encoding = null)
@@ -622,8 +622,8 @@ class StaticStringy
/** /**
* Returns true if $str contains only lower case chars, false otherwise. * Returns true if $str contains only lower case chars, false otherwise.
* *
* @param string $str String to check * @param string $str String to check
* @param string $encoding The character encoding * @param string $encoding The character encoding
* @return bool Whether or not $str contains only lower case characters * @return bool Whether or not $str contains only lower case characters
*/ */
public static function isLowerCase($str, $encoding = null) public static function isLowerCase($str, $encoding = null)
@@ -634,8 +634,8 @@ class StaticStringy
/** /**
* Returns true if $str contains only upper case chars, false otherwise. * Returns true if $str contains only upper case chars, false otherwise.
* *
* @param string $str String to check * @param string $str String to check
* @param string $encoding The character encoding * @param string $encoding The character encoding
* @return bool Whether or not $str contains only upper case characters * @return bool Whether or not $str contains only upper case characters
*/ */
public static function isUpperCase($str, $encoding = null) public static function isUpperCase($str, $encoding = null)

View File

@@ -190,7 +190,7 @@ class Stringy
* Also accepts an array, $ignore, allowing you to list words not to be * Also accepts an array, $ignore, allowing you to list words not to be
* capitalized. * 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 * @return Stringy Object with a titleized $str
*/ */
public function titleize($ignore = null) public function titleize($ignore = null)
@@ -390,8 +390,8 @@ class Stringy
* Pads $str to a given length from the begining of the string. * Pads $str to a given length from the begining of the string.
* Alias for pad($length, $padStr, 'left') * Alias for pad($length, $padStr, 'left')
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @return Stringy Object with a left padded $str * @return Stringy Object with a left padded $str
*/ */
public function padLeft($length, $padStr = ' ') public function padLeft($length, $padStr = ' ')
@@ -403,8 +403,8 @@ class Stringy
* Pads $str to a given length from the end of the string. * Pads $str to a given length from the end of the string.
* Alias for pad($length, $padStr, 'left') * Alias for pad($length, $padStr, 'left')
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @return string Object with a right padded $str * @return string Object with a right padded $str
*/ */
public function padRight($length, $padStr = ' ') 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 * Pads $str to a given length such that both sides of the string string are
* padded. Alias for pad($str, $length, $padStr, 'both', $encoding) * padded. Alias for pad($str, $length, $padStr, 'both', $encoding)
* *
* @param int $length Desired string length after padding * @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space * @param string $padStr String used to pad, defaults to space
* @return Stringy The padded string * @return Stringy The padded string
*/ */
public function padBoth($length, $padStr = ' ') public function padBoth($length, $padStr = ' ')
@@ -529,7 +529,7 @@ class Stringy
/** /**
* Returns true if $str contains $needle, false otherwise. * 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 * @return bool Whether or not $str contains $needle
*/ */
public function contains($needle) public function contains($needle)
@@ -580,8 +580,8 @@ class Stringy
* truncating occurs, the string is further truncated so that the substring * truncating occurs, the string is further truncated so that the substring
* may be appended without exceeding the desired length. * may be appended without exceeding the desired length.
* *
* @param int $length Desired length of the truncated string * @param int $length Desired length of the truncated string
* @param string $substring The substring to append if it can fit * @param string $substring The substring to append if it can fit
* @return Stringy Object with the resulting $str after truncating * @return Stringy Object with the resulting $str after truncating
*/ */
public function truncate($length, $substring = '') public function truncate($length, $substring = '')
@@ -606,8 +606,8 @@ class Stringy
* is further truncated so that the substring may be appended without * is further truncated so that the substring may be appended without
* exceeding the desired length. * exceeding the desired length.
* *
* @param int $length Desired length of the truncated string * @param int $length Desired length of the truncated string
* @param string $substring The substring to append if it can fit * @param string $substring The substring to append if it can fit
* @return Stringy Object with the resulting $str after truncating * @return Stringy Object with the resulting $str after truncating
*/ */
public function safeTruncate($length, $substring = '') public function safeTruncate($length, $substring = '')
@@ -999,8 +999,8 @@ class Stringy
* Returns the number of occurences of $substring in $str. An alias for * Returns the number of occurences of $substring in $str. An alias for
* mb_substr_count() * mb_substr_count()
* *
* @param string $substring The substring to search for * @param string $substring The substring to search for
* @return int The number of $substring occurences * @return int The number of $substring occurences
*/ */
public function count($substring) public function count($substring)
{ {