# tablepress/3.4/libraries/vendor/PhpSpreadsheet/Calculation/TextData/Trim.php

TablePress – Tables in WordPress made easy, version 3.4. 51 lines.

- Page: https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/Calculation/TextData/Trim.php
- Raw: https://pluginprobe.com/plugins/tablepress/3.4/raw/libraries/vendor/PhpSpreadsheet/Calculation/TextData/Trim.php
- Modified: 2025-08-26T04:06:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/Calculation/TextData/Trim.php#L10-L20`.

```php
<?php

namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\TextData;

use TablePress\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<mixed>|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($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<mixed>|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($stringValue = '')
	{
		if (is_array($stringValue)) {
			return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $stringValue);
		}

		$stringValue = Helpers::extractString($stringValue);

		return trim(preg_replace('/ +/', ' ', trim("$stringValue", ' ')) ?? '', ' ');
	}
}

```
