try / clear-string
string utility package for clearing special characters
Installs: 129
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/try/clear-string
This package is not auto-updated.
Last update: 2025-10-26 10:05:54 UTC
README
string utility package for clearing special characters
Install
$ composer require try/clear-string
Usage
<?php require_once '/path/to/autoload.php'; use TryPhp\stripControlCharacters; $clearedString = stripControlCharacters("Some Special\nMultiline String"); echo $clearedString; // will output "Some Special Multiline String";
API
Functions
stripControlCharacters($contents)
Function to strip control characters from a string. The function will replace \n and \t with a simple whitespace and remove any other control character (\0, \a, \b, \v, \f,\r, \e). So it cleans up the output and allows a more precise text comparison.
Arguments
| Argument | Type | Description |
|---|---|---|
| $contents | string |
The string that will be cleared. |
stripColorCharacters($contents)
Function to remove escape characters (\e) with following color code (e.g. \e[33m) from a string.
Arguments
| Argument | Type | Description |
|---|---|---|
| $contents | string |
The string that will be cleared. |
License
GPL-2.0 © Willi Eßer