C# String TrimStart
Description
String TrimStart
removes all leading occurrences of
a set of characters specified in an array from the current String object.
Syntax
String.TrimStart
has the following syntax.
public string TrimStart(
params char[] trimChars
)
Parameters
String.TrimStart
has the following parameters.
trimChars
- An array of Unicode characters to remove, or null.
Returns
String.TrimStart
method returns The string that remains after all occurrences of characters in the trimChars
parameter are removed from the start of the current string. If trimChars
is null or an empty array, white-space characters are removed instead.
Example
The following example then illustrates a call to the String.TrimStart method.
// w w w . ja va 2s . co m
using System;
public class MainClass{
public static void Main(String[] argv){
string s = " this is a test ";
Console.WriteLine(s.TrimStart());
}
}
The code above generates the following result.