Char.Parse(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将指定字符串的值转换为其等效的 Unicode 字符。
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
包含单个字符或 null.
返回
与唯一字符等效的 Unicode 字符。s
例外
s 是 null。
长度 s 不是 1。
示例
下面的代码示例演示了 Parse。
using System;
public class ParseSample {
public static void Main() {
Console.WriteLine(Char.Parse("A")); // Output: 'A'
}
}
open System
Char.Parse "A"
|> printfn "%c" // Output: 'A'
Module ParseSample
Sub Main()
Console.WriteLine(Char.Parse("A")) ' Output: 'A'
End Sub
End Module
适用于
另请参阅
- ToString()
在 .NET