How to remove vowels from a string in Java

1 Answer

0 votes
public class MyClass {
    private static String remove_vowels(String str) {
	    return str.replaceAll("[aeiouAEIOU]", "");
    }
    public static void main(String args[]) {
        String s = "C++ PHP Java Python VB.NET Rust";

	    System.out.print(remove_vowels(s));
    }
}




/*
run:

C++ PHP Jv Pythn VB.NT Rst
 
*/

 



answered Nov 21, 2022 by avibootz

Related questions

1 answer 153 views
1 answer 164 views
164 views asked Jul 26, 2020 by avibootz
1 answer 118 views
1 answer 135 views
135 views asked Nov 21, 2022 by avibootz
1 answer 134 views
1 answer 143 views
...