Checks if a String is Pangram or not by checking if each alphabet is present or not @param s The String to check @return true if s is a Pangram, otherwise false
(String s)
| 66 | * @return {@code true} if s is a Pangram, otherwise {@code false} |
| 67 | */ |
| 68 | public static boolean isPangram2(String s) { |
| 69 | if (s.length() < 26) { |
| 70 | return false; |
| 71 | } |
| 72 | s = s.toLowerCase(); // Converting s to Lower-Case |
| 73 | for (char i = 'a'; i <= 'z'; i++) { |
| 74 | if (s.indexOf(i) == -1) { |
| 75 | return false; // if any alphabet is not present, return false |
| 76 | } |
| 77 | } |
| 78 | return true; |
| 79 | } |
| 80 | } |