What is String-builder?

Om ji mishra

Total Post:17

Points:119

Posted by  Om ji mishra
C#
 523  View(s)
Ratings:
Rate this:

What is String-builder?    

  1. Re: What is String-builder?

    A string that we can change is called a StringBuilder. In this case, if we create any string object then we can perform any operation like insert, replace, etc. without creating a new instance for every time. It will update string at one place in memory doesn't create new space in memory.

    Code:-

    using System; 
    
    using System.Text;

    class GFG {
       public static void Main(String[] args)
        {
            String str = "OM ";
    StringBuilder sbl = new StringBuilder(str);
            sbl.Append("JI MISHRA");
            Console.WriteLine(sbl);
        }
    }
    Output:-
    OM JI MISHRA

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.