Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isWord(String str) { Pattern pattern = Pattern.compile("^[A-Za-z]+$"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; } else { return true; } } public static boolean isWord(char ch) { if (ch >= 'a' && ch <= 'z') return true; else if (ch >= 'A' && ch <= 'Z') return true; else return false; } }