string.replace1 [C#] C# string.Replace 메서드 public string Replace (char oldChar, char newChar); oldChar를 newChar로 치환하여 반환한다. oldChar가 없으면 기존 값을 반환한다. 현재의 인스턴스 값은 수정되지 않는다. using System; public class Example { public static void Main() { String s = new String('a', 3); Console.WriteLine("The initial string: '{0}'", s); s = s.Replace('a', 'b').Replace('b', 'c').Replace('c', 'd'); Console.WriteLine("The final string: '{0}'", s); } } [결과] The .. 2019. 9. 26. 이전 1 다음