Write a Java Program to Remove or Delete Vowels from string using inbuilt function . For this program, you have to first ask to the user to enter the string and start deleting/removing all the vowels present in the string as shown in the following program.
Since, We have two methods to delete vowels from the string : –
First method that we already discussed in the previous post that is to Program to Remove or Delete vowels manually .
Second method is shortcut method that uses the method replaceAll( ) to replace all the vowels with no-space from the string then copy that string into another string without having any vowels.
Java String replaceAll() :
The java string replaceAll() method returns a string replacing all the sequence of characters matching regex and replacement string.
Syntax :
Parameters
Return Value
Following Java program removes all the vowels present in the string using inbuilt function.We use the function named replaceAll() to remove or delete all the vowels from the string.
Here the program is successfully compiled(build) and run (Netbeans) on the windows System and produce output below .Let’s look at the following program :
SOURCE CODE : :
OUTPUT : :
need an explanation for this answer? contact us directly to get an explanation for this answer