Revise
The Text::revise provides a number of useful ways to change a string. For example trimming, cropping or converting to misc. code cases.
Example
$text = new Text('hello_world');
$text->revise()->studly();
var_dump($text->parse()); // HelloWorld
If you want to work on the text without altering the original Text object, you can clone it first. For example when using it in a condition.
if ($text->clone()->revise()->trim() == '...') {
// ...
}
Methods
crop
public function crop(int $from, int $length): Decoration
trim
public function trim(string $char = ' '): Decoration
trimLeft
public function trimLeft(string $char = ' '): Decoration
trimRight
public function trimRight(string $char = ' '): Decoration
studly
public function studly(): Decoration
snakecase
public function snakecase(): Decoration
camelcase
public function camelcase(): Decoration