文字列のn文字目を置換する方法をメモ。
[ 方法 ]
文字列targetのn文字目をrに置換します。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ScriptTest : MonoBehaviour { private void Start() { string target = "abcdefg"; int n = 0; string r = "A"; target = target.Remove(n, 1).Insert(n, r); print(target);// Abcdefg } }