Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code");
- if (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))) {
- }
- else {
- }
- String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code");
- 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))) {
- } else {
- }
- import java.util.regex.Pattern;
- ...
- String postalCode = JOptionPane.showInputDialog("Enter customer(s) " + (count + 1) + " postal code");
- if (Pattern.matches("^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]$", postalCode)) {
- } else {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement