ajout str::indent()
This commit is contained in:
parent
328169f6c5
commit
07b9324de8
@ -392,6 +392,18 @@ class str {
|
||||
return implode($glue, $pieces);
|
||||
}
|
||||
|
||||
/**
|
||||
* indenter chaque ligne de $text
|
||||
*/
|
||||
static function indent(?string $text, string $indent=" "): ?string {
|
||||
if ($text === null) return null;
|
||||
$indented = [];
|
||||
foreach (explode("\n", $text) as $line) {
|
||||
$indented[] = "$indent$line";
|
||||
}
|
||||
return implode("\n", $indented);
|
||||
}
|
||||
|
||||
const CAMEL_PATTERN0 = '/([A-Z0-9]+)$/A';
|
||||
const CAMEL_PATTERN1 = '/([A-Z0-9]+)[A-Z]/A';
|
||||
const CAMEL_PATTERN2 = '/([A-Z]?[^A-Z]+)/A';
|
||||
|
Loading…
x
Reference in New Issue
Block a user