122
return s.Substring(0,idx) + replaceChar.ToString() + s.Substring(idx+replaceChar.ToString().Length,s.Length - (idx+replaceChar.ToString().Length) );
1
using System.Linq;
2
using System.Diagnostics;
3
using System;
4
using System.Text;
5
using System.Globalization;
6
7
public static class Program
8
{
9
public static string UnicodeReplaceAt(this string str, int offset, char replaceChar)
10
{
11
int count=1;
12
string replaceBy = replaceChar.ToString();
13
return new StringInfo(str).ReplaceByPosition(replaceBy, offset, count).String;
14
}
15
16
public static StringInfo ReplaceByPosition(this StringInfo str, string replaceBy, int offset, int count)
17
{
18
return str.RemoveByTextElements(offset, count).InsertByTextElements(offset, replaceBy);
19
}
20
21
public static StringInfo RemoveByTextElements(this StringInfo str, int offset, int count)
22
{
23
return new StringInfo(string.Concat(
24
str.SubstringByTextElements(0, offset),
Cached Result
Disposal Scenario: #1
Disposal Scenario: #2
[d2].Base.Dispose()
[d2].Derived.Dispose(true)
[d2] Unmanaged memory freed at 000001d171c7bd70
[d2].Base.Dispose(true)
[d2] Removed from tracking list: 00000000022378a0
Disposal Scenario: #3
[d3].Base.Dispose()
[d3].Derived.Dispose(true)
[d3] Unmanaged memory freed at 000001d171c7c050
[d3].Base.Dispose(true)
[d3] Removed from tracking list: 000000000273be28
Disposal Scenario: #4
Objects remaining to dispose = 2
Reference Object: d1, 0000000001944fac
Reference Object: d4, 000000000056fc0a
Dequeueing finalizers...