Skip to content

Commit 4b7b01e

Browse files
authored
Strings::trim() trims ZWSP char (#304)
1 parent 79f6cb3 commit 4b7b01e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Utils/Strings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Strings
2121
{
2222
use Nette\StaticClass;
2323

24-
public const TrimCharacters = " \t\n\r\0\x0B\u{A0}";
24+
public const TrimCharacters = " \t\n\r\0\x0B\u{A0}\u{200B}";
2525

2626
/** @deprecated use Strings::TrimCharacters */
2727
public const TRIM_CHARACTERS = self::TrimCharacters;

tests/Utils/Strings.trim().phpt

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Assert::same('x', Strings::trim(" \t\n\r\x00\x0B\u{A0}x"));
1717
Assert::same('a b', Strings::trim(' a b '));
1818
Assert::same(' a b ', Strings::trim(' a b ', ''));
1919
Assert::same('e', Strings::trim("\u{158}e-", "\u{158}-")); // Ře-
20+
Assert::same('foo', Strings::trim("​foo")); // Contains \u{200B} - `ZWSPfoo`
2021

2122
Assert::exception(
2223
fn() => Strings::trim("\xC2x\xA0"),

0 commit comments

Comments
 (0)