Keep in mind that every time you replace a substring in the long
string, you allocate a whole new long string and build the altered
string into it.
Given that, you have to ask yourself two questions:
1. How long is the "long" string? Personally, in this context, I
wouldn't pay much attention unless it's over a couple of hundred
characters, unless...
2. Are you doing this over and over again? In other words, are you
doing this in a loop? If so, then StringBuilder will probably make a
significant difference, unless...
3. Do you need the replacement to be case-insensitive or culturally
aware? StringBuilder's Replace replaces only the exact string you're
searching for, not any variants on case or culture. If you're building
an internationalized application then you may not be able to use the
StringBuilder version.
In all of this, the StringBuilder version won't be much more efficient
unless you set its Capacity property, or supply the capacity as an
"int" on the constructor, something like this:
StringBuilder sb = new StringBuilder(startingString,
startingString.Length * 2);
because if you don't leave ample space for the string to expand (if the
replacement strings are longer than what they're replacing) then
StringBuilder will just waste a bunch of time expanding itself over and
over to accommodate longer and longer strings, and each expansion is a
copy, just like String.Replace.
So, if you're doing this once when your program starts up, and the
string in question is 100 characters or something like that, don't
worry about it. I would just use
String.Replace().Replace().Replace()...
If you're doing this in a loop or the string is very long (1000
characters or more) then I'd use StringBuilder, but only if I were sure
that my application would never need to worry about international /
case concerns.