String Manipulation in C#
String Manipulation is the most common part of many C# programs. Strings represent a sequence of characters. The easiest way to represent a sequence of characters in C# is by using a character array.
charname=new char; name='N'; name='a'; name='m'; name='e';
C# supports two types of strings, namely:
1. Immutable strings: String objects are immutable, it means that we can’t modify the characters contained in them. However, since the string is an alias for the predefined
System.String class in the Common Language Runtime (CLR). There are many built-in operations available that work with strings. All operations produce a modified version of the string rather than modifying the string on which the method is called.
2. Mutable strings: These strings are modifiable can be created using the
StringBuilder srk1=new StringBuilder("Webeduclick"); StringBuilder srk2=new StringBuilder("");
Where the string object srk1 is created with an initial size of three characters and srk2 is created as an empty string. They can grow dynamically as more characters are added to them. They can grow either unbounded or up to a configurable maximum. Mutable strings are also known as Dynamic Strings.