Skip to content

Commit

Permalink
Strings: added const for trim method whitespace charset
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Hejna authored and dg committed Aug 23, 2015
1 parent 45fe1f7 commit 89a7973
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Utils/Strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
class Strings
{

const TRIM_CHARACTERS = " \t\n\r\0\x0B\xC2\xA0";


/**
* Static class - cannot be instantiated.
*/
Expand Down Expand Up @@ -374,7 +377,7 @@ public static function length($s)
* @param string
* @return string
*/
public static function trim($s, $charlist = " \t\n\r\0\x0B\xC2\xA0")
public static function trim($s, $charlist = self::TRIM_CHARACTERS)
{
$charlist = preg_quote($charlist, '#');
return self::replace($s, '#^['.$charlist.']+|['.$charlist.']+\z#u', '');
Expand Down

0 comments on commit 89a7973

Please sign in to comment.