Showing posts with label remove vowel in java. Show all posts
Showing posts with label remove vowel in java. Show all posts

Friday, March 20, 2015

Remove Vowel in Java


In this article I would like to share with you a sample program that will remove vowels in a given string or sentence of our user I called this program remove vowels written in Java as our programming language. What does our program will do is to ask the user to enter any string or sentence then our program will remove or delete vowels that can be found in a given string or sentence. Regardless if the string is lower case or upper case format. I hope you will find my work useful in your learning string manipulation in Java.


If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Program Listing

import java.util.Scanner;

public class remove {
  static Scanner input = new Scanner(System.in);

  public static void main(String[] args) {

     char reply;
    do
      {
      System.out.print("\n");
 System.out.println("==============================================");
 System.out.println("||    <<<  REMOVE VOWEL PROGRAM     >>>     ||");
 System.out.println("==============================================");
      System.out.print("\n");
      System.out.print("Enter a Word or a Sentence :=>  ");
      String str = input.nextLine();
      String original_string = str;

    for (int a = 0; a < str.length(); a++) {
      char val = str.toUpperCase().charAt(a);
      if ((val == 'A') || (val == 'E')  || (val == 'I')
          || (val == 'O') || (val == 'U')) {
        String first = str.substring(0, a);
        String second = str.substring(a + 1);
        str = first + " " + second;

      }
    }
    System.out.println("\n");
    System.out.println("The Original String     :=> " + original_string + ".");
    System.out.println("The Remove Vowel String :=> "  +str+".");
    System.out.println("\n");
System.out.print("Do you Want To Continue (Y/N) :=> ");
     reply=input.next().toUpperCase().charAt(0);
    } while(reply=='Y');
    System.out.println("\n");
    System.out.println("\t ===== END OF PROGRAM ======");
    System.out.println("\n");
 }
}