次の方法で共有


Char.ToString メソッド (Char)

指定した Unicode 文字をそれと等価な文字列形式に変換します。

Overloads Public Shared Function ToString( _
   ByVal c As Char _) As String
[C#]
public static string ToString(charc);
[C++]
public: static String* ToString(__wchar_tc);
[JScript]
public static function ToString(
   c : Char) : String;

パラメータ

  • c
    Unicode 文字。

戻り値

c の値の文字列形式。

使用例

[Visual Basic, C#, C++] ToString のサンプルを次に示します。

 
Imports System

Module ToStringSample

    Sub Main()

        Dim ch As Char
        ch = "a"c
        Console.WriteLine(ch.ToString())        ' Output: "a"

        Console.WriteLine(Char.ToString("b"c))  ' Output: "b"

    End Sub

End Module

[C#] 
using System;

public class ToStringSample {
    public static void Main() {
        char ch = 'a';
        Console.WriteLine(ch.ToString());        // Output: "a"

        Console.WriteLine(Char.ToString('b'));    // Output: "b"
    }
}

[C++] 
#using <mscorlib.dll>
using namespace System;

int main() {
   char ch = 'a';
   Console::WriteLine(__box(ch));            // Output: "a"
   Console::WriteLine(Char::ToString('b'));  // Output: "b"
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

Char 構造体 | Char メンバ | System 名前空間 | Char.ToString オーバーロードの一覧 | Parse | String