Which class for making many replacements
Posted
by
HCL
on Stack Overflow
See other posts from Stack Overflow
or by HCL
Published on 2011-01-14T00:44:25Z
Indexed on
2011/01/14
0:53 UTC
Read the original article
Hit count: 258
.NET
|stringbuilder
I have to make a lot of text-replacements. Which class is best used to make this in a performant manner. Is it StringBuilder?
StringBuilder stringBuilder=new StringBuilder(startString);
stringBuilder.Replace(literala1,literala2);
stringBuilder.Replace(literalb1,literalb2);
stringBuilder.Replace(literalc1,literalc2);
...
or does exists a better class to do this. Btw, the literals will be mostly constants.
© Stack Overflow or respective owner