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