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
Post a Comment