Yosymfony\Spress\Core\Support\StringWrapper::endWith PHP Method

endWith() public method

Determine if a the string ends with a given substring.
public endWith ( string $value ) : boolean
$value string
return boolean
    public function endWith($value)
    {
        return (string) $value === substr($this->str, -strlen($value));
    }

Usage Example

示例#1
0
 public function testEndWith()
 {
     $str = new StringWrapper('Welcome to Spress');
     $this->assertTrue($str->endWith('press'));
     $this->assertFalse($str->endWith('to'));
 }