Program to remove all the occurences of a given character from a String.



package com.demo; public class RemoveCharacter { public static void main(String[] args) { // input string String inputString = "Welcome to JavaTechTube"; // output after removing character System.out.println("Output after removing character : " + removeGivenCharacter(inputString, "e")); } private static String removeGivenCharacter(String inputString, String removeCharacter) { inputString = inputString.replace(removeCharacter, ""); return inputString; } }
Share:

Program to check vowel is present in a given String or not

	

package com.demo; public class ContainsVowelsOrNot { public static void main(String[] args) { //first string String str = "Java"; System.out.println("Vowels is present : "+isVowelsPresent(str)); //second string str = "bcd"; System.out.println("Vowels is present : "+isVowelsPresent(str)); } private static boolean isVowelsPresent(String str) { if(str == null) { throw new IllegalArgumentException(); } return str.toLowerCase().matches(".*[aeiou].*"); }
Share:

Quote of the day

Popular Posts

Featured Post

Collection Framework Overview

Collection:- A collection (sometimes called a container) is simply an object that groups multiple elements into single unit. Collect...

Youtube Page

Facebook Page

Recent Posts

About

I am Shivaji Chandra and I'm a Computer Science Engineer. I love to write poems, jokes and quotes. click here →