Remove string from string in C#

To remove a string from string we use Remove method. Return type of this method is string. This method has two overloads .
  • First overload accepts start index. All String next to start index will be removed.
  • Second overload accepts start index and number of characters to remove.


stringFruit = "Orange";
Fruit = Fruit.Remove(3);
Console.WriteLine(Fruit);

OutPut
Ora

stringFruit = "Orange";
Fruit = Fruit.Remove(0,3);
Console.WriteLine(Fruit);

Output

nge

Comments

Popular posts from this blog

Check if ViewBag is null or doesn't exist

Using Progress Bar In C#

Jquery serer side datatables in asp.net