?? feifa.java
字號:
package MyLibraryok.readers;
import javax.swing.JOptionPane;
//import java.util.Date;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Feifa {
//K為 1 時表示非法, 為 0 時表示合法
public Feifa() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public boolean ftiaoxingma(String s) {
int k = 0;
if (s.length() < 5 || s.length() > 25) {
JOptionPane.showMessageDialog(null,
"請刷入6到25個數字的條形碼:", "溫馨提示", 0);
k = 1;
} else {
int a;
for (int i = 0; i < s.length(); i++) {
a = s.charAt(i);
if (a < 47 || a > 58) {
JOptionPane.showMessageDialog(null,
"請刷入正確的條形碼:", "溫馨提示", 0);
k = 1;
break;
}
}
}
if (k == 0) {
return false;
} else {
return true;
}
}
public boolean fbianhao(String s) {
int k = 0;
if (s.length() < 4 || s.length() > 12) {
JOptionPane.showMessageDialog(null,
"請輸入4到12個數字的編號:", "溫馨提示", 0);
k = 1;
} else {
int a;
for (int i = 0; i < s.length(); i++) {
a = s.charAt(i);
if (a < 47 || a > 58) {
JOptionPane.showMessageDialog(null,
"編號內請輸入數字:", "溫馨提示", 0);
k = 1;
break;
}
}
}
if (k == 0) {
return false;
} else {
return true;
}
}
public boolean fname(String s) {
int k = 0;
if (s.length() < 2 || s.length() > 20) {
JOptionPane.showMessageDialog(null,
"姓名不得少于2個或多于20個字:", "溫馨提示", 0);
k = 1;
} else {
char[] ming = new char[s.length()];
for (int i = 0; i < s.length(); i++) {
ming[i] = s.charAt(i);
}
for (int j = 0; j < s.length(); j++) {
if (ming[j] > 64 && ming[j] < 91 || ming[j] > 96 &&
ming[j] < 123 || ming[j] < 97 && ming[j] > 123 ||
ming[j] > 225) {
k = 0;
} else {
JOptionPane.showMessageDialog(null,
"姓名不可以添寫非法字符:", "溫馨提示", 0);
k = 1;
break;
}
}
}
if (k == 0) {
return false;
} else {
return true;
}
}
public boolean fdianhua(String s) {
int k = 0;
if (s.length() < 6 || s.length() > 12) {
JOptionPane.showMessageDialog(null,
"請輸入6到12位的電話號碼:", "溫馨提示", 0);
k = 1;
} else {
char[] dianhua = new char[s.length()];
for (int i = 0; i < s.length(); i++) {
dianhua[i] = s.charAt(i);
}
for (int j = 0; j < s.length(); j++) {
if (dianhua[j] < 48 || dianhua[j] > 57 || s.length() < 4 ||
s.length() > 12 || s.length() == 0) {
JOptionPane.showMessageDialog(null,
"請輸入數字:", "溫馨提示", 0);
k = 1;
break;
}
}
}
if (k == 0) {
return false;
} else {
return true;
}
}
public boolean fzhengjian(String s) {
int k = 0;
if (s.length() < 15 || s.length() > 20) {
JOptionPane.showMessageDialog(null,
"證件號碼不得超過20位或少于15位", "溫馨提示", 0);
k = 1;
} else {
char[] c = new char[s.length()];
for (int i = 0; i < s.length(); i++) {
c[i] = s.charAt(i);
}
for (int j = 0; j < s.length(); j++) {
if (c[j] > 47 && c[j] < 58 || c[j] > 87 && c[j] < 89 ||
c[j] > 119 && c[j] < 121) {
k = 0;
//break;
} else {
JOptionPane.showMessageDialog(null,
"證件號碼不合法:", "溫馨提示", 0);
k = 1;
break;
}
}
}
if (k == 0) {
return false;
} else {
return true;
}
}
private void jbInit() throws Exception {
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -