-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7738d30
commit 4a87000
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,68 @@ | ||
# String Utils | ||
|
||
![Codecov (with branch)](https://img.shields.io/codecov/c/github/WilliamSampaio/string-utils/master?style=flat-square&logo=codecov) | ||
![GitHub License](https://img.shields.io/github/license/WilliamSampaio/string-utils?style=flat-square) | ||
|
||
This library provides a number of features for manipulating strings, such as removing whitespace, accented characters, and more. | ||
|
||
## Install | ||
|
||
```bash | ||
composer require williamsampaio/string-utils | ||
``` | ||
|
||
## Usage | ||
|
||
```php | ||
<?php | ||
|
||
use StringUtils\StringProcessor; | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
$str = 'Wí¨lL/ìãm% \bê$njá@..@mi,m ! m&e(n)#ezes;? sãm*pai|o '; | ||
|
||
$str = StringProcessor::removeSpecialCharacters($str); | ||
$str = StringProcessor::ptBrReplaceAccentedCharacters($str); | ||
$str = StringProcessor::trimWhitespaces($str); | ||
$str = StringProcessor::styleTitle($str); | ||
|
||
echo $str; | ||
|
||
``` | ||
|
||
**Output:** | ||
|
||
```bash | ||
William Benjamim Menezes Sampaio | ||
``` | ||
|
||
```php | ||
<?php | ||
|
||
use StringUtils\StringProcessor; | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
$str = 'Wí¨lL/ìãm% \bê$njá@..@mi,m ! m&e(n)#ezes;? sãm*pai|o '; | ||
|
||
$str = StringProcessor::input($str, [ | ||
StringProcessor::REMOVE_SPECIAL_CHARACTERS, | ||
StringProcessor::PT_BR_REPLACE_ACCENTED_CHARACTERS, | ||
StringProcessor::TRIM_WHITESPACES, | ||
StringProcessor::STYLE_TITLE | ||
]); | ||
|
||
echo $str; | ||
|
||
``` | ||
|
||
**Output:** | ||
|
||
```bash | ||
William Benjamim Menezes Sampaio | ||
``` | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](https://raw.githubusercontent.com/WilliamSampaio/string-utils/master/LICENSE) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use StringUtils\StringProcessor; | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
$str = 'Wí¨lL/ìãm% \bê$njá@..@mi,m ! m&e(n)#ezes;? sãm*pai|o '; | ||
|
||
$str = StringProcessor::removeSpecialCharacters($str); | ||
$str = StringProcessor::ptBrReplaceAccentedCharacters($str); | ||
$str = StringProcessor::trimWhitespaces($str); | ||
$str = StringProcessor::styleTitle($str); | ||
|
||
echo $str; | ||
|
||
echo '<br>'; | ||
// OR | ||
|
||
$str = 'Wí¨lL/ìãm% \bê$njá@..@mi,m ! m&e(n)#ezes;? sãm*pai|o '; | ||
|
||
$str = StringProcessor::removeSpecialCharacters($str); | ||
$str = StringProcessor::ptBrReplaceAccentedCharacters($str); | ||
$str = StringProcessor::trimWhitespaces($str); | ||
$str = StringProcessor::styleTitle($str); | ||
|
||
$str = StringProcessor::input($str, [ | ||
StringProcessor::REMOVE_SPECIAL_CHARACTERS, | ||
StringProcessor::PT_BR_REPLACE_ACCENTED_CHARACTERS, | ||
StringProcessor::TRIM_WHITESPACES, | ||
StringProcessor::STYLE_TITLE | ||
]); | ||
|
||
echo $str; |