Advertisement
KhaldMansour

Untitled

Jan 23rd, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.util.regex.*;
  2. import java.util.regex.*;
  3.  
  4. public class Demo2
  5. {
  6. public static void main(String [] args)
  7. {
  8. String rcvd = args[0];
  9. String pattern = "^(\\d){1,3}.(\\d){1,3}.(\\d){1,3}.(\\d){1,3}$";
  10.  
  11. // Pattern r = Pattern.compile(pattern);
  12. // Matcher m = r.matcher(rcvdString);
  13. // if (m.find( ))
  14. // {
  15. //
  16. //
  17. // }
  18. // else
  19. // {
  20. // System.out.println("Not a Valid IP");
  21. // }
  22.  
  23. do
  24. {
  25. int ind = rcvd.indexOf(".");
  26. //System.out.println(ind);
  27. //System.out.println(rcvd);
  28.  
  29.  
  30. rcvd = rcvd.substring(ind+1 , rcvd.length());
  31. System.out.println(rcvd);
  32. }
  33.  
  34. while(rcvd.indexOf(".") != -1);
  35.  
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement