For the contains() method, I would just do it the way Sun did: (That method has always seemed like a waste of space to me.) As for replace(), I would use replaceAll() behind the scenes: Having to pre-process the strings seems inefficient, but (for longer target strings, at least) that will be offset by the fact that the regex package will use a Boyer-Moore algorithm to do the searching.
Joined: Aug 22, 2006
I have used used the two methods Alan provided and everything is fine.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Can you simulate String.replace(...) & String.contains(...)