문자열에 ReplaceAt()
이 없으며 필자가 필요로하는 적절한 기능을 만드는 방법에 대해 약간 논란이있다. 이렇게하면 이제 확장 방법이다문자열에서 주어진 색인의 문자를 교체 하시겠습니까?
public static string ReplaceAt(this string input, int index, char newChar)
{
if (input == null)
{
throw new ArgumentNullException("input");
}
char[] chars = input.ToCharArray();
chars[index] = newChar;
return new string(chars);
}
: 저는 CPU 비용이 높은 가정이지만 같은 모든 확인
'가지고 있지 않습니다'대신 '없는 것'이 아닙니까? :) – Abbas