Check if a String contains letter

public static boolean containsLetter(String s) {
if ( s == null )
return false;
boolean letterFound = false;
for (int i = 0; !letterFound && i < s.length(); i++)
letterFound = letterFound
|| Character.isLetter(s.charAt(i));
return letterFound;
}

Comments

Snethooshie! said…
Thank you very much. Your code is very short, but it is so powerful.


Neth

Popular posts from this blog

Connect via SSH without a password from MacOS to Linux with an SSHKEY

Escape HTML and XML in Java

Sort a HashMap based on Keys or Values