1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-09-09 04:30:46 +02:00

Add slugify

This commit is contained in:
Daniel St. Jules
2013-07-21 23:07:31 -04:00
parent 031e9e68b2
commit feb4c5a36d
3 changed files with 52 additions and 6 deletions

View File

@@ -275,7 +275,7 @@ Converts each tab in a string to some number of spaces, as defined by
$tabLength. By default, each tab is converted to 4 consecutive spaces.
```php
S:::toSpaces(' String speech = "Hi"') \\ ' String speech = "Hi"'
S::toSpaces(' String speech = "Hi"') \\ ' String speech = "Hi"'
```
##### toTabs
@@ -287,15 +287,24 @@ by $tabLength, to a tab. By default, each 4 consecutive spaces are
converted to a tab.
```php
S:::toTabs(" fòô bàř") \\ " fòô bàř"
S::toTabs(" fòô bàř") \\ " fòô bàř"
```
##### slugify
S::slugify(string $str)
Converts the supplied text into an URL slug. This includes replacing
non-ASCII characters with their closest ASCII equivalents, removing
non-alphanumeric and non-ASCII characters, and replacing whitespace with
dashes. The string is also converted to lowercase.
```php
S::slugify('Using strings like fòô bàř') // 'using-strings-like-foo-bar'
```
## TODO
**toAnchor**
**slugify**
**contains**
**between**