I would have a look at the API docs for String here. I've done this with substring and replaceFirst as a quick job but you might be able to find a better way.