Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Validate mobile number
//Title of this code //'main' method must be in a class 'Rextester'. import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { String destination=" + + ++ 919090909090"; destination.trim(); destination= destination.replaceAll("\\s",""); while(destination.startsWith("+")) { destination=new String(destination.toString().substring(1)); } if (destination.matches("^\\s*\\d+\\s*$")) { System.out.println("match"); if (destination.length() == 10 || destination.length() == 12) { System.out.println("lenght correct "); if ((destination != null)) { if (destination.matches("9{1}1{1}[7-8-9]{1}[0-9]{9}")) { System.out.println(" correct number"); } else if (destination.matches("[7-8-9]{1}[0-9]{9}")) { System.out.println("correct num"); } else { System.out.println("not correct "); } } else { System.out.println("null "); } }else { System.out.println("lenght not correct !"); } } else { System.out.println("Char not allowed !"); } System.out.println("de :"+destination+" length : "+destination.length()); } }
run
|
edit
|
history
|
help
0
Minimum Vertices to Traverse Directed Graph
javaSuperSub
1
InnerClass vs. Anonymous vs. Lambda...
calc exp ne
// Java Coding Challenge - 09: Find out duplicate numbers using HashSet
Value pair analysis
Человечки
Weird float operation!
Reverse a String