public function testTrim() { $tests = array(' foó ' => 'foó', "\tBar\n" => 'Bar'); foreach ($tests as $input => $expected) { $this->assertEquals($expected, Str::trim($input)); } $this->assertEquals("\nBaz\t", Str::trim("\nBaz\t\r", "\r")); $this->assertEquals("Boo", Str::trim("\nBoo\t\r", "", array(preg_quote("\n"), preg_quote("\t"), preg_quote("\r")))); }
/** * Wrapper for trim() * @return StrObject */ public function trim() { $value = Str::trim($this->value); return new self($value); }