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();
    }



If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]