How to replace all instances of substring in StringBuilder with C#

1 Answer

0 votes
using System;
using System.Text;

class Program
{
    static void Main()
    {
        StringBuilder sb = new StringBuilder("C# Java Java C# Python Java C");

        sb.Replace("Java", "C++");

        Console.WriteLine(sb);
    }
}







/*
run:

C# C++ C++ C# Python C++ C

*/

 



answered Oct 27, 2022 by avibootz

Related questions

2 answers 165 views
2 answers 115 views
1 answer 140 views
1 answer 124 views
...