summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/String.Manipulation.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/String.Manipulation.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/shared/System/String.Manipulation.cs b/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
index 564fca0dcd..daf6fc3dff 100644
--- a/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
+++ b/src/System.Private.CoreLib/shared/System/String.Manipulation.cs
@@ -1020,7 +1020,11 @@ namespace System
do
{
index = ci.IndexOf(this, oldValue, startIndex, this.Length - startIndex, options, &matchLength);
- if (index >= 0)
+
+ // There's the possibility that 'oldValue' has zero collation weight (empty string equivalent).
+ // If this is the case, we behave as if there are no more substitutions to be made.
+
+ if (index >= 0 && matchLength > 0)
{
// append the unmodified portion of string
result.Append(this, startIndex, index - startIndex);