PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Calculation / TextData / Trim.php

Trim.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/TextData/Trim.php

51 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\TextData;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
6
7 class Trim
8 {
9 use ArrayEnabled;
10
11 /**
12 * CLEAN.
13 *
14 * @param mixed $stringValue String Value to check
15 * Or can be an array of values
16 *
17 * @return array<mixed>|string If an array of values is passed as the argument, then the returned result will also be an array
18 * with the same dimensions
19 */
20 public static function nonPrintable($stringValue = '')
21 {
22 if (is_array($stringValue)) {
23 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue);
24 }
25
26 $stringValue = Helpers::extractString($stringValue);
27
28 return (string) preg_replace('/[\x00-\x1f]/', '', "$stringValue");
29 }
30
31 /**
32 * TRIM.
33 *
34 * @param mixed $stringValue String Value to check
35 * Or can be an array of values
36 *
37 * @return array<mixed>|string If an array of values is passed as the argument, then the returned result will also be an array
38 * with the same dimensions
39 */
40 public static function spaces($stringValue = '')
41 {
42 if (is_array($stringValue)) {
43 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue);
44 }
45
46 $stringValue = Helpers::extractString($stringValue);
47
48 return trim(preg_replace('/ +/', ' ', trim("$stringValue", ' ')) ?? '', ' ');
49 }
50 }
51