Cleans up a Text::insert() formatted string with given $options depending
on the 'clean' option. The goal of this function is to replace all whitespace
and unneeded mark-up around place-holders that did not get replaced by Text::insert().
public static clean ( string $str, array $options = [] ) : string | ||
$str | string | The string to clean. |
$options | array | Available options are: - `'before'`: characters marking the start of targeted substring. - `'after'`: characters marking the end of targeted substring. - `'escape'`: The character or string used to escape the before character or string (defaults to `'\\'`). - `'gap'`: Regular expression matching gaps. - `'word'`: Regular expression matching words. - `'replacement'`: String to use for cleaned substrings (defaults to `''`). |
Результат | string | The cleaned string. |