Hi again, please help! :)

Hi guys...i posted this problem a while ago, (a week!) and u told me to use the method replaceALL('a','')... but i dont have Java 1.4. I figured out anyway, i just used substrings...rofl :)
But: Is there a shorter way? i am running Ready to program...v 1.0.0.9
Have fun
I need help, this is a question i just cant seem to decifer.
A simple way of shortening words is to remove all vowels (Like in tel. directories).
I must write a programm that will take as input a string (of up tp 255 chars) and pritn out the same string with the vowels removed. Vowels are a,e,i,o,u. I must remove lower and Upper case vowels. without changing case of reamining string. I am not allowed to change the sapcing or punctuation.
""

Here's a small example...
public class RemoveVowels
  public static final String stripVowels(String src) {
    return RemoveVowels
      .stripVowels(src, new StringBuffer(src.length())).toString();
  public static final StringBuffer stripVowels(String src, StringBuffer buf) {
    char[] ch = src.toCharArray(); // Faster then calling charAt(...) multiple times
    for (int i = 0; i < ch.length; i++) {
      switch (ch) {
case 'A': case 'a':
case 'E': case 'e':
case 'I': case 'i':
case 'O': case 'o':
case 'U': case 'u':
break;
default:
buf.append(ch[i]);
return buf;
public static void main(String[] args) {
for (int i = 0; i < args.length; i++) {
System.out.println(args[i]);
System.out.print(" => ");
System.out.println(RemoveVowels.stripVowels(args[i]));
The command 'java RemoveVowels "This is a test, can I remove vowels?"' gave the following output:
This is a test, can I remove vowels?
=> Ths s  tst, cn  rmv vwls?It's quite fast too...
Regards,
  /H&aring;kan

Similar Messages

Maybe you are looking for

  • Vertical scroll bar for the table

    Hi, I have a table which will contain more than 100 rows. First Visible rows will be 10. i want a vertical scroll bar for the table, so that i can see all the rows using vertical scroll bar. While scrolling down, the header row, which contain names o

  • What are the best Earbud Headphones for $50 or Le

    Hey i was wondering what the best earbud headphones were for less than $50 shipped. I want a design like EP-630 Or the CX-300 's. But what are the BEST for my price range? CX's look good but are there anything better? Thanks,Matt

  • How to use own or other creditcard in Family Share?

    Hello together, i'm using the Family Sharing functionality(for example my dad set up the Family Share), great ideal. But now i want to buy an App on my own and do not want to use the Family-Creditcard but my own creditcard (sometimes i want to pay on

  • Can't create a leave request via ptarq

    hi all, i can't create neither approve any request via ptarq ? anyhelp would be appreciated .

  • Custumize error message

    Hi How can I customize ORA error messages? For example I have a master-detail page generated with JHeadstart 10.1.2. When I delete a master with details I get this error message: ORA-02292: integrity constraint (APL.PWL_PWJ_FK) violated - child recor