public static char toChar(String str) {
        if (StringUtils.isEmpty(str)) {
            throw new IllegalArgumentException("The String must not be empty");
        }
        return str.charAt(0);
    }
<p>Converts the String to a char using the first character, throwing
an exception on empty Strings.</p>

<pre>
  CharUtils.toChar("A")  = 'A'
  CharUtils.toChar("BA") = 'B'
  CharUtils.toChar(null) throws IllegalArgumentException
  CharUtils.toChar("")   throws IllegalArgumentException
</pre>

@param str  the character to convert
@return the char value of the first letter of the String
@throws IllegalArgumentException if the String is empty
android/android_framework/base/src/main/java/lang3/CharUtils.java