Stringy\Stringy::toAscii PHP Method

toAscii() public method

Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed unless instructed otherwise.
public toAscii ( boolean $removeUnsupported = true ) : Stringy
$removeUnsupported boolean Whether or not to remove the unsupported characters
return Stringy Object whose $str contains only ASCII characters
    public function toAscii($removeUnsupported = true)
    {
        $str = $this->str;
        foreach ($this->charsArray() as $key => $value) {
            $str = str_replace($value, $key, $str);
        }
        if ($removeUnsupported) {
            $str = preg_replace('/[^\\x20-\\x7E]/u', '', $str);
        }
        return static::create($str, $this->encoding);
    }