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

Add surround and insert

This commit is contained in:
Daniel St. Jules
2013-07-22 23:22:38 -04:00
parent 8ddb4b91b5
commit ca4a924ba9
3 changed files with 96 additions and 9 deletions

View File

@@ -315,16 +315,28 @@ Returns true if $haystack contains $needle, false otherwise.
S::contains('Ο συγγραφέας είπε', 'συγγραφέας', 'UTF-8') // true
```
##### surround
S::surround(string $str, string $substring)
Surrounds a string with the given substring.
```php
S::surround(' ͜ ', 'ʘ'); // 'ʘ ͜ ʘ'
```
##### insert
S::insert(string $str, int $index, string $substring [, string $encoding ])
Inserts $substring into $str at the $index provided.
```php
S::insert('fòô bà', 'ř', 6, 'UTF-8'); // 'fòô bàř'
```
## TODO
**between**
**surround**
**replace** => substr_replace
**insert**
**truncate**
**prune**