本文整理汇总了C#中System.Text.StringBuilder.StartsWith方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.StartsWith方法的具体用法?C# StringBuilder.StartsWith怎么用?C# StringBuilder.StartsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.StartsWith方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateTest1
public void UpdateTest1()
{
StringBuilder str = new StringBuilder("[TestString]");
Assert.IsTrue(str.StartsWith("["));
Assert.IsTrue(str.EndsWith("]"));
Assert.AreEqual("TestString", str.UnBracketing(StringPair.SquareBracket).ToString());
}
示例2: StartsWith_StringNotAtStart
public void StartsWith_StringNotAtStart()
{
StringBuilder builder = new StringBuilder();
builder.Append("abcdefg");
string startString = "bcd";
bool startsWith = builder.StartsWith(startString);
Assert.IsFalse(startsWith);
startString = "BCD";
startsWith = builder.StartsWith(startString, StringComparison.OrdinalIgnoreCase);
Assert.IsFalse(startsWith);
}
示例3: StartsWith_ContainsNonAsciiCharacters
public void StartsWith_ContainsNonAsciiCharacters()
{
StringBuilder builder = new StringBuilder();
builder.Append("\u3041\u3042\u3043\u3044");
string startString = "\u3041\u3042";
bool startsWith = builder.StartsWith(startString);
Assert.IsTrue(startsWith);
}
示例4: StartsWith_StringEmpty
public void StartsWith_StringEmpty()
{
StringBuilder builder = new StringBuilder();
builder.Append("abcdefg");
string startString = string.Empty;
bool startsWith = builder.StartsWith(startString);
}
示例5: StartsWith_StringNull
public void StartsWith_StringNull()
{
StringBuilder builder = new StringBuilder();
builder.Append("abcdefg");
string startString = null;
bool startsWith = builder.StartsWith(startString);
}