String Remove() : Method() is used to remove characters in the string, starting from the specified position. If you want delete a particular length of characters to delete from the given .
Syntax :
class Program
{
static void Main(string[] args)
{
string str = "csharp-tutorial-point";
string data = str.Remove(6);
System.Console.WriteLine("Remove the string : "+data);
System.Console.ReadLine();
}
}
Output :
Remove the string : csharp
class Program
{
static void Main(string[] args)
{
string str = "csharp-tutorial-point";
string data = str.Remove(1,6);
System.Console.WriteLine("Remove the string : "+data);
System.Console.ReadLine();
}
}
Output :
Remove the string : ctutorial-point
Next
34. string.Copy()
35. String Join()
36. String Indexof()
37. String Split
Syntax :
- public string Remove(int data);
- public string Remove(int start_Index, int end_Index);
class Program
{
static void Main(string[] args)
{
string str = "csharp-tutorial-point";
string data = str.Remove(6);
System.Console.WriteLine("Remove the string : "+data);
System.Console.ReadLine();
}
}
Output :
Remove the string : csharp
- Starting from the position (startIndex) and the second syntax is used to delete the particular length of a string by defining the starting position and length of characters.
class Program
{
static void Main(string[] args)
{
string str = "csharp-tutorial-point";
string data = str.Remove(1,6);
System.Console.WriteLine("Remove the string : "+data);
System.Console.ReadLine();
}
}
Output :
Remove the string : ctutorial-point
Next
34. string.Copy()
35. String Join()
36. String Indexof()
37. String Split