java 判断一个字串中的字符全是字母
2015-07-16 18:16
357 查看
记录一个方法,用来判断一个字串中字符是否全为字母 public class MainClass { public static void main(String[] args){ String str = "hhhggdxszfff"; boolean is_boolean = isPhonticName(str); System.out.println(is_boolean); } public static boolean isPhonticName(String str) { char[] chars=str.toCharArray(); boolean isPhontic = false; for(int i = 0; i < chars.length; i++) { isPhontic = (chars[i] >= 'a' && chars[i] <= 'z') || (chars[i] >= 'A' && chars[i] <= 'Z'); if (!isPhontic) { return false; } } return true; } }
相关文章推荐
- eclipse使用技巧
- eclipse使用技巧
- Java将时间加5分钟的方法
- Java中静态代码块、非静态代码块、构造函数的执行顺序与作用
- JAVA集合操作的利器:CollectionUtils
- Java Collections.sort 用法
- Java中Json字符串直接转换为对象(包括多层List集合)
- java中的char,short,int,long占几个字节
- 【OSGi】Could not find bundle: org.eclipse.equinox.console
- 关于魅族手机无法链接到eclipse
- Spring contextConfigLocation和ContextLoaderListener理解。
- java 解析 html 的利器-->jsoup
- HDFS的java接口——简化HDFS文件系统操作
- eclipse里,android项目下如何attach source
- argument.callee
- Thinking in java 读书笔记
- JAVA面试题:Spring中bean的生命周期
- Spring AOP声明式事务异常回滚
- spring中@Component注解
- spring aop中的propagation的7种配置的意思