Good day. I thing I found an error in StringBuilder class for Replace method:
public StringBuilder Replace( string oldValue, string newValue, int
startIndex, int count )
An error occurs then we replace substring and the length of result
string becomes longer then before operation. This is because is this
case the end-of-string is replaced and there is no tailing \0. The
garbage present in the result. For example, the next code shows the
problem:
StringBuilder sb = new StringBuilder ();
sb.Append ("This, is, a, list");
Console.WriteLine( sb );
sb.Replace (",", " comma-separated ", 0, 13);
Console.WriteLine( sb );
The result string in the second print will be 'This comma-separated'
and a garbage at the tail....:(
Problem was found for version 1.1.7, but the same code still present for
1.1.8. BTW, MS .NET doesn't have this bug.
We have a patch for this problem. I append it to the message. Please, if
it's ok for everyone, supply it to the common source base.
StringBuilder.diff
Description: StringBuilder.diff
_______________________________________________ Mono-devel-list mailing list [email protected] http://lists.ximian.com/mailman/listinfo/mono-devel-list
