filter all the vowels in python code example
Example 1: python method to filter vowels in a string
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
return newstr
Example 2: Java program to delete vowels in a given string
// Java program to delete vowels in a given string
import java.util.*;
public class RemoveVowelsInString
{
public static void main(String[] args)
{
String str = "Deekshit Prasad";
System.out.println("Given string: " + str);
str = str.replaceAll("[AaEeIiOoUu]", "");
System.out.println("After deleting vowels in given a string: " + str);
}
}