Char.Parse(String) Char.Parse(String) Char.Parse(String) Char.Parse(String) Method

定義

將指定的字串值轉換成它的對等 Unicode 字元。Converts the value of the specified string to its equivalent Unicode character.

public:
 static char Parse(System::String ^ s);
public static char Parse (string s);
static member Parse : string -> char
Public Shared Function Parse (s As String) As Char

參數

s
String String String String

包含單一字元的字串,或 nullA string that contains a single character, or null.

傳回

Unicode 字元,相當於 s 中的唯一字元。A Unicode character equivalent to the sole character in s.

例外狀況

s 的長度不是 1。The length of s is not 1.

範例

下列程式碼範例將Parse示範。The following code example demonstrates Parse.

using namespace System;
int main()
{
   Console::WriteLine( Char::Parse(  "A" ) ); // Output: 'A'
}

using System;

public class ParseSample {
    public static void Main() {
        Console.WriteLine(Char.Parse("A")); // Output: 'A'
    }
}
Module ParseSample

    Sub Main()

        Console.WriteLine(Char.Parse("A")) ' Output: 'A'

    End Sub

End Module

適用於

另請參閱