public static boolean isAlphanumericSpace(CharSequence cs) {
        if (cs == null) {
            return false;
        }
        int sz = cs.length();
        for (int i = 0; i < sz; i++) {
            if (Character.isLetterOrDigit(cs.charAt(i)) == false && cs.charAt(i) != ' ') {
                return false;
            }
        }
        return true;
    }
<p>Checks if the CharSequence contains only Unicode letters, digits
or space ({@code ' '}).</p>

<p>{@code null} will return {@code false}.
An empty CharSequence (length()=0) will return {@code true}.</p>

<pre>
StringUtils.isAlphanumericSpace(null)   = false
StringUtils.isAlphanumericSpace("")     = true
StringUtils.isAlphanumericSpace("  ")   = true
StringUtils.isAlphanumericSpace("abc")  = true
StringUtils.isAlphanumericSpace("ab c") = true
StringUtils.isAlphanumericSpace("ab2c") = true
StringUtils.isAlphanumericSpace("ab-c") = false
</pre>

@param cs  the CharSequence to check, may be null
@return {@code true} if only contains letters, digits or space,
 and is non-null
@since 3.0 Changed signature from isAlphanumericSpace(String) to isAlphanumericSpace(CharSequence)
android/android_framework/base/src/main/java/lang3/StringUtils.java