Skip to main content
edited tags
Link
mtk
  • 13.8k
  • 16
  • 75
  • 116
edited tags
Link
ojblass
  • 21.8k
  • 23
  • 89
  • 137
Source Link
ojblass
  • 21.8k
  • 23
  • 89
  • 137

Faster alternatives to replace method in a Java String?

The fact that the replace method returns a string object rather than replacing the contents of a given string is a little obtuse (but understandable when you know that strings are immutable in Java). I am taking a major performance hit by using a deeply nested replace in some code. Is there something I can replace it with that would make it faster?