replaceAll replacing multiple strings

Discussion in 'Java' started by lles, Oct 19, 2011.

  1. lles

    lles

    Joined:
    Oct 18, 2011
    Messages:
    1
    Likes Received:
    0
    Hi,

    Say I have a string with the format:

    s = " one: two, three: four, five: six "

    How do I use replaceAll to replace "one", "three", and "five" with "" without having to resort to s.replaceAll("one", "").replaceAll("three", "").replaceAll("six","");

    That is, how do I combine all three replaceAll calls into one call?

    Thanks
     
    lles, Oct 19, 2011
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.