Performance improvement for ReplaceFirst function (#13018)

* Some benchmarks for replacefirst & span method

(cherry picked from commit e550a4ce3a)
This commit is contained in:
patrickdemooij9
2023-03-23 21:11:59 +01:00
committed by Sebastiaan Janssen
parent 888173ac5b
commit eee6207f19
4 changed files with 78 additions and 2 deletions

View File

@@ -326,6 +326,14 @@ public class StringExtensionsTests
Assert.AreEqual(expected, output);
}
[TestCase("test to test", "test", "release", "release to test")]
[TestCase("nothing to do", "test", "release", "nothing to do")]
public void ReplaceFirst(string input, string search, string replacement, string expected)
{
var output = input.ReplaceFirst(search, replacement);
Assert.AreEqual(expected, output);
}
[Test]
public void IsFullPath()
{