17 lines
395 B
Java
17 lines
395 B
Java
//: strings/IntegerMatch.java
|
|
// ©2015 MindView LLC: see Copyright.txt
|
|
|
|
public class IntegerMatch {
|
|
public static void main(String[] args) {
|
|
System.out.println("-1234".matches("-?\\d+"));
|
|
System.out.println("5678".matches("-?\\d+"));
|
|
System.out.println("+911".matches("-?\\d+"));
|
|
System.out.println("+911".matches("(-|\\+)?\\d+"));
|
|
}
|
|
} /* Output:
|
|
true
|
|
true
|
|
false
|
|
true
|
|
*///:~
|