Vjy Vjy - 8 months ago 23
Java Question

Find if first character in a string is upper case, Java

In java, Find if first character in a string is upper case without using regular expression.

Answer

Assuming s is non-empty:

Character.isUpperCase(s.charAt(0))

or, as mentioned by divec, to make it work for characters with code points above U+FFFF:

Character.isUpperCase(s.codePointAt(0));