init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
50
lib/PhpSpreadsheet/Calculation/TextData/Trim.php
Normal file
50
lib/PhpSpreadsheet/Calculation/TextData/Trim.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation\TextData;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
|
||||
|
||||
class Trim
|
||||
{
|
||||
use ArrayEnabled;
|
||||
|
||||
/**
|
||||
* CLEAN.
|
||||
*
|
||||
* @param mixed $stringValue String Value to check
|
||||
* Or can be an array of values
|
||||
*
|
||||
* @return array|string If an array of values is passed as the argument, then the returned result will also be an array
|
||||
* with the same dimensions
|
||||
*/
|
||||
public static function nonPrintable(mixed $stringValue = '')
|
||||
{
|
||||
if (is_array($stringValue)) {
|
||||
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue);
|
||||
}
|
||||
|
||||
$stringValue = Helpers::extractString($stringValue);
|
||||
|
||||
return (string) preg_replace('/[\\x00-\\x1f]/', '', "$stringValue");
|
||||
}
|
||||
|
||||
/**
|
||||
* TRIM.
|
||||
*
|
||||
* @param mixed $stringValue String Value to check
|
||||
* Or can be an array of values
|
||||
*
|
||||
* @return array|string If an array of values is passed as the argument, then the returned result will also be an array
|
||||
* with the same dimensions
|
||||
*/
|
||||
public static function spaces(mixed $stringValue = ''): array|string
|
||||
{
|
||||
if (is_array($stringValue)) {
|
||||
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue);
|
||||
}
|
||||
|
||||
$stringValue = Helpers::extractString($stringValue);
|
||||
|
||||
return trim(preg_replace('/ +/', ' ', trim("$stringValue", ' ')) ?? '', ' ');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue