1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-09-02 01:22:37 +02:00

Update tests for pad, add padLeft, padRight and padBoth

This commit is contained in:
Daniel St. Jules
2013-07-17 00:43:44 -04:00
parent c1bfe35f57
commit e85687fd5b
3 changed files with 161 additions and 17 deletions

View File

@@ -17,6 +17,9 @@ A PHP library with a variety of string manipulation functions with multibyte sup
* [clean](#clean)
* [standardize](#standardize)
* [pad](#pad)
* [padLeft](#padleft)
* [padRight](#padright)
* [padBoth](#padboth)
* [Tests](#tests)
* [License](#license)
@@ -203,9 +206,40 @@ default string used for padding is a space, and the default type (one of
S::pad('fòô bàř', 10, '¬ø', 'left', 'UTF-8'); // '¬ø¬fòô bàř'
```
## TODO
##### padLeft
**center**
S::padLeft(string $str , int $length [, string $padStr [, string $encoding]])
Returns a new string of a given length such that the beginning of the
string is padded. Alias for pad($str, $length, $padStr, 'left', $encoding)
```php
S::padLeft('foo bar', 9, ' '); // ' foo bar'
```
##### padRight
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
padded. Alias for pad($str, $length, $padStr, 'right', $encoding)
```php
S::padRight('foo bar', 10, '_*'); // 'foo bar_*_'
```
##### padBoth
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
string are padded. Alias for pad($str, $length, $padStr, 'both', $encoding)
```php
S::padBoth('foo bar', 9, ' '); // ' foo bar '
```
## TODO
**startsWith**