Stringbuilder ignores last space
Posted
by
chead23
on Stack Overflow
See other posts from Stack Overflow
or by chead23
Published on 2012-11-02T16:30:57Z
Indexed on
2012/11/02
17:02 UTC
Read the original article
Hit count: 181
I am initialising a StringBuilder
as follows:
StringBuilder builder = new StringBuilder("Symptoms are ");
After this I loop through a list and add each string item to the end using
foreach(var item in list)
{
builder.Append(item);
}
An example item
would be something like "headache" but once i've appended it to "Symptoms are " and called builder.ToString()
it shows:
"Symptoms areHeadache...etc"
as opposed to
"Symptoms are Headache...etc"
Why is it ignoring the space?
© Stack Overflow or respective owner