Is there a way to build a Java String using an SLF4J-style formatting function?

后端 未结 3 1596
既然无缘
既然无缘 2021-02-07 03:39

I\'ve heard that using StringBuilder is faster than using string concatenation, but I\'m tired of wrestling with StringBuilder objects all of the time. I was recently exposed t

3条回答
  •  忘掉有多难
    2021-02-07 04:18

    Plus it worth bearing in min that String.format() is a bad implementation of sprintf done with regexps, so if you profile your code you will see an patterns and int[] that you were not expecting. MessageFormat and the slf MessageFormmater are generally faster and allocate less junk

提交回复
热议问题