Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code");
  2.  
  3. if (Character.isLetter(postalCode.charAt(0)) &&
  4. Character.isDigit(postalCode.charAt(1)) &&
  5. Character.isLetter(postalCode.charAt(2)) &&
  6. Character.isDigit(postalCode.charAt(3)) &&
  7. Character.isLetter(postalCode.charAt(4)) &&
  8. Character.isDigit(postalCode.charAt(5))) {
  9. }
  10. else {
  11. }
  12.  
  13. String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code");
  14.  
  15. if ((postalCode.length() == 7) && Character.isLetter(postalCode.charAt(0)) && Character.isDigit(postalCode.charAt(1)) && Character.isLetter(postalCode.charAt(2)) && Character.isDigit(postalCode.charAt(3)) && Character.isLetter(postalCode.charAt(4)) && Character.isDigit(postalCode.charAt(5))) {
  16.  
  17. } else {
  18. }
  19.  
  20. import java.util.regex.Pattern;
  21. ...
  22. String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code");
  23. if (Pattern.matches("^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]$", postalCode)) {
  24.  
  25. } else {
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement