本文整理汇总了C#中Utf8String.StartsWith方法的典型用法代码示例。如果您正苦于以下问题:C# Utf8String.StartsWith方法的具体用法?C# Utf8String.StartsWith怎么用?C# Utf8String.StartsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utf8String
的用法示例。
在下文中一共展示了Utf8String.StartsWith方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartsWithUtf8String
public void StartsWithUtf8String(string s, string pattern)
{
Utf8String u8s = new Utf8String(s);
Utf8String u8pattern = new Utf8String(pattern);
Assert.Equal(s.StartsWith(pattern), u8s.StartsWith(u8pattern));
}
示例2: TryParseMethod
internal static bool TryParseMethod(ReadOnlySpan<byte> buffer, out HttpMethod method, out int parsedBytes)
{
var bufferString = new Utf8String(buffer);
if(bufferString.StartsWith(s_Get))
{
method = HttpMethod.Get;
parsedBytes = s_Get.Length;
return true;
}
if (bufferString.StartsWith(s_Post))
{
method = HttpMethod.Post;
parsedBytes = s_Post.Length;
return true;
}
if (bufferString.StartsWith(s_Put))
{
method = HttpMethod.Put;
parsedBytes = s_Put.Length;
return true;
}
if (bufferString.StartsWith(s_Delete))
{
method = HttpMethod.Delete;
parsedBytes = s_Delete.Length;
return true;
}
method = HttpMethod.Unknown;
parsedBytes = 0;
return false;
}
示例3: StartsWithCodeUnit
public void StartsWithCodeUnit(string s, char c)
{
Utf8String u8s = new Utf8String(s);
Utf8CodeUnit codeUnit = (Utf8CodeUnit)(byte)c;
Assert.Equal(s.StartsWith(c.ToString()), u8s.StartsWith(codeUnit));
}