src/Str.php
public function replaceSuffix($searchFor, $replaceWith = null) {
		if ($this->endsWith($searchFor)) {
			return $this->replaceLast($searchFor, $replaceWith);
		}
		else {
			return $this;
		}
	}
public function replaceSuffix($searchFor, $replaceWith = null) {
		if ($this->endsWith($searchFor)) {
			return $this->replaceLast($searchFor, $replaceWith);
		}
		else {
			return $this;
		}
	}
public function replaceSuffix ( $ searchFor , $ replaceWith = null ) { if ( $ this -> endsWith ( $ searchFor ) ) { return $ this -> replaceLast ( $ searchFor , $ replaceWith ) ; } else { return $ this ; } }
Replaces the specified part in this string only if it ends with that part

@param string $searchFor the string to search for
@param string $replaceWith the string to use as the replacement (optional)
@return static a new instance of this class
Replaces the specified part in this string only if it ends with that part