Is there a version of Apache's StringUtils.replaceEach()
that returns a StringBuilder
or StringBuffer
instead of String
? I'd like to avoid copying code. If not, is there another library?
Asked
Active
Viewed 1,186 times
1

Jens Piegsa
- 7,399
- 5
- 58
- 106

Josh Unger
- 6,717
- 6
- 33
- 55
-
I would use indexOf and replace. – Peter Lawrey Nov 19 '13 at 19:45
-
No StringUtils.replaceEach() will return only String not StringBuilder or StringBuffer,but you can use others. – Charles Stevens Nov 20 '13 at 08:52
1 Answers
0
All of StringUtils
's methods return String
s. You could, however, always do something like this:
StringBuilder builder =
new StringBuilder(StringUtils.replaceEach(myString, searchList, replaceList));

Mureinik
- 297,002
- 52
- 306
- 350