The TrimStart function in C# is utilized to eliminate any leading instances of a specified array of characters from the current String instance.
Signature
Example
public string TrimStart(params Char[] ch)
Parameter
ch: it is a char array type parameter.
Return
It returns a string.
C# String TrimStart Method Example
Example
using System;
public class StringExample
{
public static void Main(string[] args)
{
string s1 = "Hello C#";
char[] ch = {'H'};
string s2 = s1.TrimStart(ch);
Console.WriteLine(s2);
}
}
Output:
Output
ello C#