本文整理汇总了C#中Utf8String.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Utf8String.ToString方法的具体用法?C# Utf8String.ToString怎么用?C# Utf8String.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utf8String
的用法示例。
在下文中一共展示了Utf8String.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToStringPointerTest
public unsafe void ToStringPointerTest()
{
byte[] utf8Bytes = Encoding.UTF8.GetBytes("1258Hello");
fixed(byte* bytes = utf8Bytes)
{
var utf8String = new Utf8String(bytes, utf8Bytes.Length);
Assert.Equal("1258Hello", utf8String.ToString());
}
}
示例2: Bug869DoesNotRepro
//[Fact(Skip = "issue #869")]
public void Bug869DoesNotRepro()
{
var bytes = new byte[] { 0xF0, 0xA4, 0xAD, 0xA2 };
var utf8String = new Utf8String(bytes);
var str = "𤭢";
var strFromUtf8 = utf8String.ToString();
Assert.Equal(str, strFromUtf8);
}
示例3: ToStringTest
public void ToStringTest(string s)
{
var utf8string = new Utf8String(Encoding.UTF8.GetBytes(s));
Assert.Equal(s, utf8string.ToString());
}
示例4: TestCodePointReverseEnumerator
private void TestCodePointReverseEnumerator(string s, Utf8String u8s)
{
List<UnicodeCodePoint> codePoints = new List<UnicodeCodePoint>();
Utf8String.CodePointReverseEnumerator it = u8s.CodePoints.GetReverseEnumerator();
while (it.MoveNext())
{
codePoints.Add(it.Current);
}
codePoints.Reverse();
Utf16LittleEndianCodePointEnumerable utf16CodePoints = new Utf16LittleEndianCodePointEnumerable(s);
Assert.Equal(utf16CodePoints, codePoints);
Utf8String u8s2 = new Utf8String(codePoints);
Assert.Equal(u8s, u8s2);
Assert.Equal(s, u8s2.ToString());
}
示例5: StringEqualsConvertedToUtf16String
public unsafe void StringEqualsConvertedToUtf16String(bool expected, Utf8String s1, Utf8String s2)
{
Assert.Equal(expected, s1.Equals(s2.ToString()));
Assert.Equal(expected, s2.Equals(s1.ToString()));
}
示例6: ToString
public void ToString(string expected, Utf8String s)
{
Assert.Equal(expected, s.ToString());
}
示例7: ToStringTest
public unsafe void ToStringTest()
{
byte[] utf8Bytes = Encoding.UTF8.GetBytes("1258Hello");
var utf8String = new Utf8String(utf8Bytes);
Assert.Equal("1258Hello", utf8String.ToString());
}
示例8: RoundTrip
public void RoundTrip(string s)
{
Utf8String u8s = new Utf8String(s);
Assert.Equal(s, u8s.ToString());
}
示例9: Utf16StringToUtf8StringToUtf16StringRoundTrip
public void Utf16StringToUtf8StringToUtf16StringRoundTrip(string utf16String)
{
Utf8String utf8String = new Utf8String(utf16String);
Assert.Equal(utf16String, utf8String.ToString());
}