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 147 views
1 answer 162 views
162 views asked Jul 26, 2020 by avibootz
1 answer 114 views
1 answer 130 views
130 views asked Nov 21, 2022 by avibootz
1 answer 132 views
1 answer 139 views
...