package shark.zd.数组操作;
public class ArrayStr { char[] cStr={'a','b','c','d','e','f','g','h', 'i','j','k','l','m','n','o','p', 'q','r','s','t','u','v','w','x','y','z'}; public boolean IsStr(String sPara){ for(int i=0;i<sPara.length();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; } public static void main(String[] arges){ ArrayStr mNum=new ArrayStr(); boolean bIsNum = mNum.IsStr("adf"); System.out.println("bIsNum is "+bIsNum); bIsNum =mNum.IsStr("adf4s"); System.out.println("bIsNum is "+bIsNum); }
}
|