Java determines whether the string contains letters
•
Java
Here is the programming house jb51 CC collects and arranges code fragments through the network.
Programming house Xiaobian now shares it with you and gives you a reference.
/** * 该方法主要使用正则表达式来判断字符串中是否包含字母 * @author fenggaopan 2015年7月21日 上午9:49:40 * @param cardNum 待检验的原始卡号 * @return 返回是否包含 */ public boolean judgeContainsStr(String cardNum) { String regex=".*[a-zA-Z]+.*"; Matcher m=Pattern.compile(regex).matcher(cardNum); return m.matches(); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码