Automation Using Selenium Webdriver
Showing posts with label Java program to remove vowels from string java. Show all posts
Showing posts with label Java program to remove vowels from string java. Show all posts

Wednesday, 16 November 2016

Java program to remove vowels from string java

  • java program to remove vowels from a string
  • To remove vowels from a string we can use predefined method of string  replaceAll()
  • By passing all vowels to the method replaceAll() with empty it will replaces all vowels with empty. 
  • Check below topic for more programs on string 
Program #1: Java example program to remove all vowels from a String



  1. package inheritanceInterviewPrograms;
  2. public class RemoveVowels {
  3.  
  4.     /**
  5.      * @http://corejavawithselenium.blogspot.in/
  6.      * @String interview programs asked in interviews
  7.      * @Remove vowels from a string in java
  8.      */
  9.  
  10.  public static void main(String[] args) {
  11.  
  12.         String str = "RemoveVowels";
  13.         String resustr = str.replaceAll("[aeiouAEIOU]", "");
  14.         System.out.println(resustr);
  15.  
  16.     }
  17.  
  18. }

 Output:


  1. RmvVwls