Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 26, 2020 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/55fba509bb1e5dfa988e49f5d7639f3a to your computer and use it in GitHub Desktop.
Save parzibyte/55fba509bb1e5dfa988e49f5d7639f3a to your computer and use it in GitHub Desktop.
public static boolean contieneSoloLetras(String cadena) {
for (int x = 0; x < cadena.length(); x++) {
char c = cadena.charAt(x);
// Si no está entre a y z, ni entre A y Z, ni es un espacio
if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == ' ')) {
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment