//初始化数组变量
String[] sMail = {"@","."};
char[] cNum = {'1','2','3','4','5','6','7','8','9','0'};
char[] cStr = {'a','b','c','d','e','f','g','h','r',
'i','j','k','l','m','n','o','p','q',
's','t','u','v','w','x','y','z'};
/**
* 校验电子邮件
*/
public boolean isMail(String sPara){
for(int i=0;i<sMail.length;i++){
if(sPara.indexOf(sMail[i])==-1)
return false;
}
return true;
}
/**
* 判断是否是数字
*/
public boolean isNumber(String sPara){
int iPLength = sPara.length();
for(int i=0;i<iPLength;i++){
char cTemp = sPara.charAt(i);
boolean bTemp = false;
for(int j=0;j<cNum.length;j++){
if(cTemp==cNum[j]){
bTemp = true;
break;
}
}
if(!bTemp) return false;
}
return true;
}
/**
* 方法说明:判断是否都是英文字符
*/
public boolean isString(String sPara){
int iPLength = sPara.length();
for(int i=0;i<iPLength;i++){
char cTemp = sPara.charAt(i);
boolean bTemp = false;
for(int j=0;j<cStr.length;j++){
if(cTemp==cStr[j]){
bTemp = true;
break;
}
}
if(!bTemp) return false;
}
return true;
}