Wednesday, July 16, 2008

Replacing Brackets in a String (Java)

Trivial issue really but something I always forget...

sNiceString = sNiceString.replaceAll("\\(", "");

or

sNiceString = sNiceString.replaceAll("\\)", "");


You could probably use a purer regular expression too but this does the job.


3 comments:

  1. Thanks u!!! It really works!!!

    ReplyDelete
  2. Anonymous11:06 AM

    Thanks so much!!!
    saved me a lot of time.

    ReplyDelete
  3. Anonymous12:22 PM

    thanx a lot

    ReplyDelete