Stringy\Stringy::ensureRight PHP Méthode

ensureRight() public méthode

Ensures that the string ends with $substring. If it doesn't, it's appended.
public ensureRight ( string $substring ) : Stringy
$substring string The substring to add if not present
Résultat Stringy Object with its $str suffixed by the $substring
    public function ensureRight($substring)
    {
        $stringy = static::create($this->str, $this->encoding);
        if (!$stringy->endsWith($substring)) {
            $stringy->str .= $substring;
        }
        return $stringy;
    }