C#或Java:使用StringBuilder的前面加上字符串? [英] C# or Java: Prepend strings with StringBuilder?
本文介绍了C#或Java:使用StringBuilder的前面加上字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我们可以使用的StringBuilder
追加字符串。有没有一种方法,我们可以在前面加上字符串中使用(即在一个字符串的前面添加字符串)的StringBuilder
,所以我们可以保持性能优势的StringBuilder
优惠?
I know we can append strings using StringBuilder
. Is there a way we can prepend strings (i.e. add strings in front of a string) using StringBuilder
so we can keep the performance benefits that StringBuilder
offers?
推荐答案
使用的设置为0的位置参数插入方法是一样preappending。
Using the Insert method with the position parameter set to 0 would be the same as preappending.
这也适用于C#,但我相信Java的StringBuilder的也有类似的方法。
This goes for C#, but I am sure Java StringBuilder has a similar method.
这篇关于C#或Java:使用StringBuilder的前面加上字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文