Returns a new string with all elements of $set joined by $str
@param array $arr
@param self $str
@return \static
964627
public static function join(array $arr, self $str){
		return new static(\implode($str->_Value, $arr), $str->_Encoding);
	}
187727
public static function shuffle($str, $encoding = null)
    {
        return (string) Stringy::create($str, $encoding)->shuffle();
    }
618762
protected function _stringHasR($str) {
		foreach (func_get_args() as $arg) {
			if (strpos($arg, "\r") !== false) {
				return true;
			}
		}
		return false;
	}
498083
static function repeat($str, $n) {
        $nstr = '';

        for ($i = 0; $i < $n; $i++) {
            $nstr .= $str;
        }

        return $nstr;
    }
565118
public static function oxford_join($arr, string $separator = 'and') {
		if (! \is_array($arr) || ! \count($arr)) {
			return '';
		}

		$separator = \trim($separator);
		if (! $separator) {
			$separator = 'and';
		}
		$separator = " $separator ";

		// Let's build a nice array of joinable elements.
		$out = array();
		foreach ($arr as $v) {
			if ($v && (\is_string($v) || \is_numeric($v))) {
				$out[] = (string) $v;
			}
		}

		// Low counts don't require commas.
		if (\count($out) <= 2) {
			return \implode($separator, $out);
		}

		$last = (string) \array_pop($out);
		return \implode(', ', $out) . ",$separator" . $last;
	}
216852
public function writeOutput($str)
    {
        if (empty($str)) {
            return $this;
        }

        $this->output[] = $str;

        if ($this->consoleOutput) {
            $this->consoleOutput->writeln($str);
        }

        return $this;
    }
604967
public static function alnum($str)
    {
        if(is_array($str)){
            foreach($str as $key=>$val){
                $str[$key] = self::alnum($val);
            }
            return $str;
        }
        return preg_replace('/[^0-9a-z]/i', '', $str);
    }
78316
public function fillByArray(array $arr): self {
        $count  = 0;
        foreach (static::defaults(true) as $key => $default) {
            isset($arr[$count]) && $this->set($key, $arr[$count]);
            $count++;
        }
        return $this;
    }
56488
public static function altrim($str, $arr)
    {
        try {
            foreach ($arr as &$item) {
                if (is_string($item)) {
                    $str= preg_replace("/^{$item}/", '', $str);
                }
            }

            return $str;
        } catch (\Exception $e) {}
    }
22624
public function multiAttr(String $str, Array $array = []) : String
    {
        $perm  = $this->settings['attr']['perm'] ?? NULL;

        if( is_array($array) )
        {
            $open  = '';
            $close = '';
            $att   = '';
           

            foreach( $array as $k => $v )
            {
                if( ! is_numeric($k) )
                {
                    $element = $k;

                    if( ! is_array($v) )
                    {
                        $att = ' '.$v;
                    }
                    else
                    {
                        $att = $this->attributes($v);
                    }
                }
                else
                {
                    $element = $v;
                }

                $open .= '<'.$element.$att.'>';
                $close = '</'.$element.'>'.$close;
            }
        }
        else
        {
            return $this->_perm($perm, $str);
        }

        return $this->_perm($perm, $open.$str.$close);
    }
1182403
public static function strrev($str)
    {
        $result = '';
        $strLen = static::length($str);

        if (!$strLen) {
            return $result;
        }

        for ($i = $strLen - 1; $i >= 0; $i--) {
            $result .= static::substr($str, $i, 1);
        }

        return $result;
    }
1279817
public static function getString(&$str)
    {
        $p = strpos($str, "\x00");
        if ($p === false) {
            return '';
        }
        $r   = static::binarySubstr($str, 0, $p);
        $str = static::binarySubstr($str, $p + 1);

        return $r;
    }
828492
public static function getString(&$str)
    {
        $p = mb_orig_strpos($str, "\x00");
        if ($p === false) {
            return '';
        }
        $r = mb_orig_substr($str, 0, $p);
        $str = mb_orig_substr($str, $p + 1);
        return $r;
    }
513746
protected static function ourStrlen($str)
    {
        // Premature optimization: cache the function_exists() result
        static $exists = null;
        if ($exists === null) {
            $exists = \function_exists('\\mb_strlen');
        }

        // If it exists, we need to make sure we're using 8bit mode
        if ($exists) {
            return \mb_strlen($str, '8bit');
        }
        return \strlen($str);
    }
392941
public static function fromString($str)
    {
        $set = new Stringset();
        $data = str_split($str, 1);
        $pos = 0;

        list(,$magic) = unpack('L', self::mergechars($data, $pos, 4));

        if ($magic !== self::MAGIC_NUMBER) {
            throw new Exception("This is not a MO string.");
        }

        list(,$version) = unpack('L', self::mergechars($data, $pos, 4));

        if ($version !== self::REVISION) {
            throw new Exception("This file format revision is not supported.");
        }

        list(,$nstrings) = unpack('L', self::mergechars($data, $pos, 4));
        list(,$ostart) = unpack('L', self::mergechars($data, $pos, 4));
        list(,$tstart) = unpack('L', self::mergechars($data, $pos, 4));

        for ($i = 0; $i < $nstrings; $i += 1) {
            $original = $ostart + ($i * 8);
            $translated = $tstart + ($i * 8);
            $original = unpack('Llength/Loffset', self::mergechars($data, $original, 8));
            $translated = unpack('Llength/Loffset', self::mergechars($data, $translated, 8));

            $id = self::mergechars($data, $original['offset'], $original['length'] + 1, false);
            $value = self::mergechars($data, $translated['offset'], $translated['length'] + 1, false);

            if ($id[strlen($id) - 1] !== self::NUL || $value[strlen($value) - 1] !== self::NUL) {
                throw new Exception("String wasn't NUL-terminated");
            }

            $result = array();

            $id = explode(self::NUL, $id);
            if (count($id) === 3) {
                $result['msgid_plural'] = $id[1];
            }
            $id = explode(self::EOT, $id[0]);
            if (count($id) === 2) {
                $result['msgctxt'] = $id[0];
                $result['msgid'] = $id[1];
            } else {
                $result['msgid'] = $id[0];
            }

            $value = explode(self::NUL, $value);
            array_pop($value);
            $result['msgstr'] = $value;
            $set->add($result);
        }
        return $set;
    }
876476
private function contains($str, array $arr)
    {
        foreach ($arr as $a) {
            if (stripos($a, $str) !== false) {
                return true;
            }
        }

        return false;
    }
1306324
public static function strrev(&$str) {
		cast::string($str, true);

		if (! $str) {
			return false;
		}

		\preg_match_all('/./us', $str, $arr);
		$str = \implode('', \array_reverse($arr[0]));

		return true;
	}