本文整理汇总了C#中System.Text.UTF7Encoding.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# UTF7Encoding.GetString方法的具体用法?C# UTF7Encoding.GetString怎么用?C# UTF7Encoding.GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.UTF7Encoding
的用法示例。
在下文中一共展示了UTF7Encoding.GetString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Text;
public class SamplesUTF7Encoding {
public static void Main() {
// Create an instance of UTF7Encoding.
UTF7Encoding u7 = new UTF7Encoding( true );
// Create byte arrays from the same string containing the following characters:
// Latin Small Letter Z (U+007A)
// Latin Small Letter A (U+0061)
// Combining Breve (U+0306)
// Latin Small Letter AE With Acute (U+01FD)
// Greek Small Letter Beta (U+03B2)
String myStr = "za\u0306\u01FD\u03B2";
// Encode the string.
byte[] myBArr = new byte[u7.GetByteCount( myStr )];
u7.GetBytes( myStr, 0, myStr.Length, myBArr, 0 );
// Decode the byte array.
Console.WriteLine( "The new string is: {0}", u7.GetString( myBArr, 0, myBArr.Length ) );
}
}
/*
This code produces the following output. The question marks take the place of characters that cannot be displayed at the console.
The new string is: za??
*/