C# TrimStart() 方法 id 用于从当前 String 对象中删除数组中指定的一组字符的所有前导匹配项。
public string TrimStart(params Char[] ch)
ch:它是一个char数组类型参数。
它返回一个字符串。
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);
}
}
输出:
ello C#
