Faster alternatives to replace method in a Java String?

后端 未结 10 1413
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 11:07

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 strin

10条回答
  •  时光说笑
    2020-12-14 11:47

    I agree with the above. Use StringBuffer for thread-safety and StringBuilder when working with single threads.

提交回复
热议问题