-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathPangramString.java
More file actions
46 lines (37 loc) · 1.2 KB
/
PangramString.java
File metadata and controls
46 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package PangramString;
public class PangramString {
// Function to check if a string
// contains all the letters from
// a to z (ignoring case)
public static void
allLetter(String str)
{
// Converting the given string
// into lowercase
str = str.toLowerCase();
boolean allLetterPresent = true;
// Loop over each character itself
for (char ch = 'a'; ch <= 'z'; ch++) {
// Check if the string does not
// contains all the letters
if (!str.contains(String.valueOf(ch))) {
allLetterPresent = false;
break;
}
}
// Check if all letter present then
// print "Yes", else print "No"
if (allLetterPresent)
System.out.println("Yes");
else
System.out.println("No");
}
// Driver Code
public static void main(String args[])
{
// Given string str
String str = "Abcdefghijklmnopqrstuvwz12";
// Function call
allLetter(str);
}
}