Skip to content

Commit

Permalink
[*]: fixed docs
Browse files Browse the repository at this point in the history
  • Loading branch information
voku committed Sep 9, 2016
1 parent e9ed5e5 commit 3c9d67d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1071,47 +1071,47 @@ Search a string for any of a set of characters.
UTF8::strpbrk('-中文空白-', '白'); // '白-'
```

##### strpos(string $haystack, string $char_list) : int|false
##### strpos(string $haystack, string $needle, int $offset = 0, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : int|false

Find position of first occurrence of string in a string.

```php
UTF8::strpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 8
```

##### stripos($str, $needle, $before_needle = false) : int|false
##### stripos(string $str, string $needle, int $offset = null, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : int|false

Finds position of first occurrence of a string within another, case insensitive.

```php
UTF8::strpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 8
```

##### strrpos(string $haystack, string $needle, int $offset = 0, string $encoding, bool $cleanUtf8 = false) : string|false
##### strrpos(string $haystack, string $needle, int $offset = 0, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string|false

Find position of last occurrence of a string in a string.

```php
UTF8::strrpos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 13
```

##### strripos(string $haystack, string $needle, int $offset = 0, string $encoding, bool $cleanUtf8 = false) : string|false
##### strripos(string $haystack, string $needle, int $offset = 0, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string|false

Find position of last occurrence of a case-insensitive string.

```php
UTF8::strripos('ABC-ÖÄÜ-中文空白-中文空白', '中'); // 13
```

##### strrchr(string $haystack, string $needle, bool $part = false, string $encoding) : string|false
##### strrchr(string $haystack, string $needle, bool $part = false, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string|false

Finds the last occurrence of a character in a string within another.

```php
UTF8::strrchr('κόσμεκόσμε-äöü', 'κόσμε'); // 'κόσμε-äöü'
```

##### strrichr(string $haystack, string $needle, bool $part = false, string $encoding) : string|false
##### strrichr(string $haystack, string $needle, bool $part = false, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string|false

Finds the last occurrence of a character in a string within another, case insensitive.

Expand All @@ -1135,10 +1135,12 @@ Finds the length of the initial segment of a string consisting entirely of chara
UTF8::strspn('iñtërnâtiônàlizætiøn', 'itñ'); // '3'
```

##### strstr(string $str, string $needle, bool $before_needle = false) : string
##### strstr(string $str, string $needle, bool $before_needle = false, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Returns part of haystack string from the first occurrence of needle to the end of haystack.

alias: UTF8::strchr()

```php
$str = 'iñtërnâtiônàlizætiøn';
$search = 'nât';
Expand All @@ -1147,10 +1149,12 @@ UTF8::strstr($str, $search)); // 'nâtiônàlizætiøn'
UTF8::strstr($str, $search, true)); // 'iñtër'
```

##### stristr(string $str, string $needle, bool $before_needle = false) : string
##### stristr(string $str, string $needle, bool $before_needle = false, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Returns all of haystack starting from and including the first occurrence of needle to the end.

alias: UTF8::strichr()

```php
$str = 'iñtërnâtiônàlizætiøn';
$search = 'NÂT';
Expand All @@ -1167,15 +1171,15 @@ Unicode transformation for case-less matching.
UTF8::strtocasefold('ǰ◌̱'); // 'ǰ◌̱'
```

##### strtolower(string $str, string $encoding = 'UTF-8') : string
##### strtolower(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Make a string lowercase.

```php
UTF8::strtolower('DÉJÀ Σσς Iıİi'); // 'déjà σσς iıii'
```

##### strtoupper(string $str, string $encoding = 'UTF-8') : string
##### strtoupper(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Make a string uppercase.

Expand Down Expand Up @@ -1213,7 +1217,7 @@ UTF8::substr_compare("○●◎\r", '◎●', 1, 2); // 1
UTF8::substr_compare("○●◎\r", '●◎', 1, 2); // 0
```

##### substr_count(string $haystack, string $needle, int $offset = 0, int $length = null, string $encoding = 'UTF-8') : int|false
##### substr_count(string $haystack, string $needle, int $offset = 0, int $length = null, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : int|false

Count the number of substring occurrences.

Expand All @@ -1229,7 +1233,7 @@ Replace text within a portion of a string.
UTF8::substr_replace(array('Iñtërnâtiônàlizætiøn', 'foo'), 'æ', 1); // array('Iæñtërnâtiônàlizætiøn', 'fæoo')
```

##### swapCase(string $str, string string $encoding = 'UTF-8') : string
##### swapCase(string $str, string string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Returns a case swapped version of the string.

Expand Down Expand Up @@ -1270,7 +1274,7 @@ alias: UTF8::toLatin1()
UTF8::to_utf8(UTF8::to_latin1(' -ABC-中文空白- ')); // ' -ABC-????- '
```

##### ucfirst(string $str) : string
##### ucfirst(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Makes string's first char uppercase.

Expand All @@ -1280,7 +1284,7 @@ alias: UTF8::ucword()
UTF8::ucfirst('ñtërnâtiônàlizætiøn'); // 'Ñtërnâtiônàlizætiøn'
```

##### ucwords(string $str) : string
##### ucwords(string $str, array $exceptions = array(), string $charlist = '', string $encoding = 'UTF-8', bool $cleanUtf8 = false) : string

Uppercase for all words in the string.

Expand Down
2 changes: 1 addition & 1 deletion src/voku/helper/UTF8.php
Original file line number Diff line number Diff line change
Expand Up @@ -5053,7 +5053,7 @@ public static function strwidth($str, $encoding = 'UTF-8', $cleanUtf8 = false)
* @param string $encoding [optional] <p>Default is UTF-8</p>
* @param boolean $cleanUtf8 [optional] <p>Clean non UTF-8 chars from the string.</p>
*
* @return string Returns a sub-string specified by the start and length parameters.
* @return string <p>Returns a sub-string specified by the start and length parameters.</p>
*/
public static function substr($str, $start = 0, $length = null, $encoding = 'UTF-8', $cleanUtf8 = false)
{
Expand Down

0 comments on commit 3c9d67d

Please sign in to comment.