RegexMatchespublic class RegexMatches extends Object Demonstrate Pattern.matches().
Created: April, 2002 |
Methods Summary |
---|
private static boolean | goodAnswer(java.lang.String answer)
return (Pattern.matches ("[Yy]es|[Yy]|[Oo][Kk]|[Tt]rue", answer));
| public static void | main(java.lang.String[] argv)
if (goodAnswer (argv [0])) {
System.out.println ("Good Answer");
} else {
System.out.println ("Sorry, answer is no");
}
|
|