No E Allowed


Collapse Content

The Kingdom of Zumbania decided to ban the letter 'e'. Create a method that replaces every 'e' in a String with an 'a'.

Note: Capital E's should be replaced with Capital A's.

Challenge

Replace every 'e' with an 'a' and return the 'sanitized' String.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Comments

  • Hints, please. Or someone from outside that might post a possible solution

  • @David, search for 'replace' on the Learneroo or Oracle Java reference (linked to on sidebar).

  • I understand that String are not mutable. However i can not manage to print "Avarything Has Changad" as a single word, instead it is done as 3 different words...

  • I have tried with replace previously and had the exact same issue where it prints:

    Avarything
    Has
    Changad

    Instead of:

    Avarything Has Changad

    cont...
  • Look, even if i return just 'word' without doing any modification, the "Everything Has Changed" is still cut off:

    Correct Output

    alaphant
    Angland
    string
    Avarything Has Changad
    oranga
    aal

    Your Output

    elephant
    England
    string
    Everything
    Has
    Changed

  • @David, sorry about that, it's fixed.

  • Thanks Admin :) I was becoming quite insane hehe.

  • a solution:

    my code

  • quick and dirty solution would be :
    return text.replace(a,b).replace(A,B)

Contact Us
Sign in or email us at [email protected]