From 6117e7c88a9b05a9c4affff5f4577969e517fd26 Mon Sep 17 00:00:00 2001 From: Gonzalo Paniagua Javier Date: Thu, 30 Jun 2005 23:22:00 +0000 Subject: [PATCH] from head svn path=/branches/mono-1-1-8/mcs/; revision=46811 --- mcs/class/corlib/System.Text/ChangeLog | 6 ++++++ mcs/class/corlib/System.Text/StringBuilder.cs | 3 +++ 2 files changed, 9 insertions(+) diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog index 6a93f6fc034e7..5b792c2c08f4a 100755 --- a/mcs/class/corlib/System.Text/ChangeLog +++ b/mcs/class/corlib/System.Text/ChangeLog @@ -1,3 +1,9 @@ +2005-06-21 Ben Maurer + + * StringBuilder.cs (Replace): Do the correct thing when we replace + with a longer string. Thanks to Alexander Beznozdrev + + 2005-05-26 Ben Maurer * Encoding.cs: Use static object for locking. `volatile' to diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs index 8be44d6e0e45a..d0d36dd7ac9fe 100644 --- a/mcs/class/corlib/System.Text/StringBuilder.cs +++ b/mcs/class/corlib/System.Text/StringBuilder.cs @@ -296,7 +296,10 @@ public StringBuilder Replace( string oldValue, string newValue, int startIndex, InternalEnsureCapacity (replace.Length + (_length - count)); + string end = _str.Substring (startIndex + count, _length - startIndex - count ); + String.InternalStrcpy (_str, startIndex, replace); + String.InternalStrcpy (_str, startIndex + replace.Length, end); _length = replace.Length + (_length - count);