-
Notifications
You must be signed in to change notification settings - Fork 0
/
PLAY_with_character_CLASS.java
55 lines (44 loc) · 1.4 KB
/
PLAY_with_character_CLASS.java
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
47
48
49
50
51
52
53
54
55
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PLAY_with_character_CLASS{
static String toLower(String S) {
String ff= S.toLowerCase();
return ff ;
}
static String isVowel(char c){
String d="";
d+=c;
if(d.matches("[aeiouAEIOU]")) {
return "YES";
}
return "NO";
}
static String removeVowels(String S) {
// code here
return S.replaceAll("[aeiouAEIOU]", "");
}
static void split_string(String text) {
String[] fruits = text.split(",\\s"); // Splits the string at commas, removing any surrounding whitespace
for (String fruit : fruits) {
System.out.println(fruit);}
}
public static void main(String[] args) {
System.out.println(removeVowels("rqwef3434rr3fdeewrfEW3EED"));
String text = "Apple, Banana, Chserry, Date";
split_string(text);
String e5=toLower("deDgjotoSFsd");
System.out.println(e5);
System.out.println(isVowel('e'));
}
// String text = "The quick brown fox jumps over the lazy dog";
// Pattern pattern = Pattern.compile("\\b[a-zA-Z]{5}\\b"); // Matches words with exactly 5 alphabetic characters
// Matcher matcher = pattern.matcher(text);{
// while (matcher.find()) {
// System.out.println(matcher.group()); }
//}
/* Output:
quick
brown
jumps
*/
}