SHARE
TWEET

Untitled

a guest Oct 14th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package batapgiuaky;
  2.  
  3. import java.time.format.DateTimeParseException;
  4. import java.util.InputMismatchException;
  5.  
  6. /**
  7.  *
  8.  * @author lengh
  9.  */
  10. public class BatLoi {
  11.     public static void Loi(Exception e){
  12.         if(e instanceof InputMismatchException){
  13.             SaiKieuDuLieu();
  14.         }
  15.     }
  16.     private static void SaiKieuDuLieu(){
  17.         System.out.println("Nhap Sai Kieu Du Lieu");
  18.     }
  19.     public static void LoiNgay(Exception e){
  20.         if(e instanceof DateTimeParseException){
  21.             System.out.println("Ngay Thang khong hop le ");
  22.         }
  23.     }
  24. public static int CheckID(final String str) {                
  25.     String cc = str;
  26.     if(cc == null || cc.isEmpty()) return 0;
  27.  
  28.     for(char c : cc.substring(0,2).toCharArray()){
  29.         if(Character.isDigit(c)){
  30.             System.out.println("Wrong Input ID");
  31.             return 0;
  32.         }
  33.     }
  34.    
  35.  
  36.     for(char c : str.substring(2,5).toCharArray()){
  37.         if(!Character.isDigit(c)){
  38.             return 0;
  39.         }
  40.            
  41.     }
  42.     System.out.println("OK");
  43.     return 1;
  44.     }
  45.    
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top