|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting StringBuilder.Length not behaving per documentationPerhaps this has been discussed elsewhere - if so, I couldn't find it.
The StringBuilder.Length property is explicitly documented as padding the length with spaces if .Length is set to a value greater than the current length. I'm hoping to get this behavior. However, when I set .Length to something greater than the current length, the padding is done with null characters ('\0'), not spaces. Is this the actual intended behavior (and the docs are wrong) or a bug (and the docs are right)? Any help in this would be appreciated. Thanks, Donnie Hello, soccerdad!
s> The StringBuilder.Length property is explicitly documented as padding s> the length with spaces if .Length is set to a value greater than the s> current length. I'm hoping to get this behavior. However, when I set s> .Length to something greater than the current length, the padding is s> done with null characters ('\0'), not spaces. Is this the actual s> intended behavior (and the docs are wrong) s> or a bug (and the docs are right)? IMO the docs are not right, or they're not reflecting what is really happening. I think that it is correct to do padding with \0. Imagine what whould happen if you will increase string length, and then call StringBuilder.ToString()? Space is a character. Some other developer after calling StringBuilder.ToString() will cry: "What happened? I didn't insert those spaces". |
|||||||||||||||||||||||