Test if a String starts with a digit or uppercase letterTag(s): String/Number


With JDK1.4, regex expression can be handled directly.
import java.util.regex.Pattern;
...
boolean startsWithDigitOrUpper(String s) {
  return Pattern.compile("^[A-Z0-9]").matcher(s).find();
}

blog comments powered by Disqus