public static function trimStringRight($str, $remove)
	{
		if (!is_string($str))
			throw new InvalidArgumentException('$str has to be a string');

		if (!is_string($remove))
			throw new InvalidArgumentException('$remove has to be a string');

		$len    = strlen($remove);
		$offset = strlen($str) - $len;

		while(0 < $offset && strpos($str, $remove, $offset) === $offset)
		{
			$str    = substr($str, 0, $offset);
			$offset = strlen($str) - $len;
		}

		return $str;
	}