Skip to content

This library provides a number of features for manipulating strings, such as removing whitespace, accented characters, and more.

License

Notifications You must be signed in to change notification settings

WilliamSampaio/string-utils

Repository files navigation

String Utils

Codecov (with branch) GitHub Release GitHub License

This library provides a number of features for manipulating strings, such as removing whitespace, accented characters, and more.

Install

composer require williamsampaio/string-utils

Usage

<?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:

William Benjamim Menezes Sampaio
<?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:

William Benjamim Menezes Sampaio

License

The MIT License (MIT). Please see License File for more information.

About

This library provides a number of features for manipulating strings, such as removing whitespace, accented characters, and more.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published