stop silly recursion. Implement init vers of question answering
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
namespace Utils
|
||||
{
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string ReplaceLast(this string str, string oldValue, string newValue)
|
||||
{
|
||||
int index = str.LastIndexOf(oldValue);
|
||||
|
||||
return index < 0
|
||||
? str
|
||||
: str.Remove(index, oldValue.Length)
|
||||
.Insert(index, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user