Checks whether the string contains *only* uppercase characters.

@param   string  $str            The string to match,
@param   string|null $encoding   The encoding to use.
@return  bool
968970
public static function uppercase(string $str, string $encoding = null) : bool
    {
        return static::matchesPattern($str, '^[[:upper:]]*$', $encoding);
    }
991214
public static function swapCase($str, $encoding = null)
    {
        return (string) Stringy::create($str, $encoding)->swapCase();
    }
670280
public static function reverse(string $str, string $encoding = null) : string
    {
        $encoding = $encoding ?: static::encoding($str);
        $length   = mb_strlen($str, $encoding);
        $result   = '';

        // Return early under obvious circumstances.
        if ($length === 0) {
            return $result;
        }

        // Reverse one character after the other, counting from the end.
        for ($i = $length - 1; $i >= 0; $i--) {
            $result .= mb_substr($str, $i, 1, $encoding);
        }

        return $result;
    }
635456
public static boolean isAllUpperCase(String str) {

	if (str == null) return false;

	boolean hasLetters = false;
	char c;

	for (int i = str.length() - 1; i >= 0; i--) {

	    c = str.charAt(i);
	    if (Character.isLetter(c)) {

		if (!Character.isUpperCase(c)) return false;

		hasLetters = true;
	    }
	}

	return hasLetters;
    }
1356970
public static String trimEncoding(String str, boolean upperCase)
    {
        int i = 0;
        int len = str.length();

        // Let's first check if String is fine as is:
        for (; i < len; ++i) {
            char c = str.charAt(i);
            if (c <= CHAR_SPACE || !Character.isLetterOrDigit(c)) {
                break;
            }
        }

        if (i == len) {
            return str;
        }

        // Nope: have to trim it
        StringBuilder sb = new StringBuilder();
        if (i > 0) {
            sb.append(str.substring(0, i));
        }
        for (; i < len; ++i) {
            char c = str.charAt(i);
            if (c > CHAR_SPACE && Character.isLetterOrDigit(c)) {
                if (upperCase) {
                    c = Character.toUpperCase(c);
                }
                sb.append(c);
            }
        }

        return sb.toString();
    }
506178
public function ensureSuffix($substring, $encoding = null)
    {
        if (!$this->hasMbstring()) {
            $len = \strlen($substring);
            if (\substr($this->string, -$len) == $substring) {
                return $this;
            }
        } else {
            $encoding = $this->encoding($encoding);

            $len = \mb_strlen($substring, $encoding);
            if (\mb_substr($this->string, -$len, \mb_strlen($this->string, $encoding), $encoding) == $substring) {
                return $this;
            }
        }

        return $this->suffix($substring);
    }
1284029
public function isCharset($string, $encoding)
    {
        return strtoupper($this->detect($string, [], true)) == strtoupper($encoding);
    }
27938
public static function lcfirst($str, $encoding = null)
    {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        switch (static::strlen($str, $encoding)) {
            case 0:
                return '';
                break;
            case 1:
                return static::strtolower($str, $encoding);
                break;
            default:
                preg_match('/^(.{1})(.*)$/us', $str, $matches);

                return static::strtolower($matches[1], $encoding) . $matches[2];
                break;
        }
    }
335374
public static boolean hasText(@Nullable CharSequence str) {
        if (isEmpty(str)) {
            return false;
        }

        int strLen = str.length();
        for (int i = 0; i < strLen; i++) {
            if (!Character.isWhitespace(str.charAt(i))) {
                return true;
            }
        }
        return false;
    }
286555
public function encodeString($str, $encoding = 'base64')
    {
        $encoded = '';
        switch (strtolower($encoding)) {
            case 'base64':
                $encoded = chunk_split(
                    base64_encode($str),
                    static::STD_LINE_LENGTH - strlen(static::$LE),
                    static::$LE
                );
                break;
            case '7bit':
            case '8bit':
                $encoded = static::normalizeBreaks($str);
                // Make sure it ends with a line break
                if (substr($encoded, -(strlen(static::$LE))) != static::$LE) {
                    $encoded .= static::$LE;
                }
                break;
            case 'binary':
                $encoded = $str;
                break;
            case 'quoted-printable':
                $encoded = $this->encodeQP($str);
                break;
            default:
                $this->setError($this->lang('encoding') . $encoding);
                break;
        }

        return $encoded;
    }
1269524
public static function is_utf8($str) {
		if (\is_numeric($str) || \is_bool($str)) {
			return true;
		}
		elseif (\is_string($str)) {
			return (bool) \preg_match('//u', $str);
		}

		return false;
	}
1331917
public static function CaseCompare ($string1, $string2, $encoding = Encoding::DEFAULT_ENCODING) {
		return strcasecmp(Encoding::Adjust($string1, $encoding), Encoding::Adjust($string2, $encoding));
	}
212549
public static function Compare ($string1, $string2, $encoding = Encoding::DEFAULT_ENCODING) {
		return strcmp(Encoding::Adjust($string1, $encoding), Encoding::Adjust($string2, $encoding));
	}
808073
function isAllUpperCase (str) {
  return str
    .split("")
    .map(ch => ch.charCodeAt(0))
    .every(n => n >= 65 && n <= 90);
}
725641
public static function dashed(string $str, string $encoding = null) : string
    {
        return static::delimit($str, '-', $encoding);
    }
135741
public static function upper( $string, $encoding = null )
	{
		if ( is_null( $encoding ) )
		{
			$encoding = ClanCats::$config->charset;
		}
		return mb_strtoupper( $string, $encoding );
	}
674131
public static function is_ascii($str)
    {
        for($i=0; $i<strlen($str); $i++){
            if(ord($str{$i}) >127) return false;
        }
        return true;
    }