TextInfo.ToTitleCase メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TextInfo.ToTitleCase メソッドの意味・解説 

TextInfo.ToTitleCase メソッド

指定した文字列タイトル文字変換します

名前空間: System.Globalization
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

例外例外
例外種類条件

ArgumentNullException

strnull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

"en-US" カルチャを基に、文字列大文字/小文字区別規則変更する例を次に示します

Imports System
Imports System.Globalization

Public Class SamplesTextInfo

   Public Shared Sub Main()

      ' Defines the string with mixed casing.
      Dim myString As String
 = "wAr aNd pEaCe"

      ' Creates a TextInfo based on the "en-US" culture.
      Dim myTI As TextInfo = New
 CultureInfo("en-US", False).TextInfo

      ' Changes a string to lowercase.
      Console.WriteLine("""{0}""
 to lowercase: {1}", myString, myTI.ToLower(myString))

      ' Changes a string to uppercase.
      Console.WriteLine("""{0}""
 to uppercase: {1}", myString, myTI.ToUpper(myString))

      ' Changes a string to titlecase.
      Console.WriteLine("""{0}""
 to titlecase: {1}", myString, myTI.ToTitleCase(myString))

   End Sub 'Main 

End Class 'SamplesTextInfo


'This code produces the following output.
'
'"wAr aNd pEaCe" to lowercase: war and peace
'"wAr aNd pEaCe" to uppercase: WAR AND PEACE
'"wAr aNd pEaCe" to titlecase: War And Peace


using System;
using System.Globalization;


public class SamplesTextInfo  {

   public static void Main()
  {

      // Defines the string with mixed casing.
      string myString = "wAr aNd pEaCe";

      // Creates a TextInfo based on the "en-US" culture.
      TextInfo myTI = new CultureInfo("en-US",false).TextInfo;

      // Changes a string to lowercase.
      Console.WriteLine( "\"{0}\" to lowercase: {1}", myString,
 myTI.ToLower( myString ) );

      // Changes a string to uppercase.
      Console.WriteLine( "\"{0}\" to uppercase: {1}", myString,
 myTI.ToUpper( myString ) );

      // Changes a string to titlecase.
      Console.WriteLine( "\"{0}\" to titlecase: {1}", myString,
 myTI.ToTitleCase( myString ) );

   }

}

/*
This code produces the following output.

"wAr aNd pEaCe" to lowercase: war and peace
"wAr aNd pEaCe" to uppercase: WAR AND PEACE
"wAr aNd pEaCe" to titlecase: War And Peace

*/
using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Defines the String* with mixed casing.
   String^ myString = "wAr aNd pEaCe";
   
   // Creates a TextInfo based on the S"en-US" culture.
   CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false
 );
   TextInfo^ myTI = MyCI->TextInfo;
   
   // Changes a String* to lowercase.
   Console::WriteLine( "\"{0}\" to lowercase: {1}", myString,
 myTI->ToLower( myString ) );
   
   // Changes a String* to uppercase.
   Console::WriteLine( "\"{0}\" to uppercase: {1}", myString,
 myTI->ToUpper( myString ) );
   
   // Changes a String* to titlecase.
   Console::WriteLine( "\"{0}\" to titlecase: {1}", myString,
 myTI->ToTitleCase( myString ) );
}

/*
This code produces the following output.

S"wAr aNd pEaCe" to lowercase: war and peace
S"wAr aNd pEaCe" to uppercase: WAR AND PEACE
S"wAr aNd pEaCe" to titlecase: War And Peace

*/
import System.*;
import System.Globalization.*;

public class SamplesTextInfo
{   
    public static void main(String[]
 args)
    {
        // Defines the string with mixed casing.
        String myString = "wAr aNd pEaCe";

        // Creates a TextInfo based on the "en-US" culture.
        TextInfo myTI = (new CultureInfo("en-US", false)).get_TextInfo();

        // Changes a string to lowercase.
        Console.WriteLine("\"{0}\" to lowercase: {1}", 
            myString, myTI.ToLower(myString));    

        // Changes a string to uppercase.
        Console.WriteLine("\"{0}\" to uppercase: {1}", 
            myString, myTI.ToUpper(myString));

        // Changes a string to titlecase.
        Console.WriteLine("\"{0}\" to titlecase: {1}", 
            myString, myTI.ToTitleCase(myString));
    } //main
} //SamplesTextInfo

/*
This code produces the following output.

"wAr aNd pEaCe" to lowercase: war and peace
"wAr aNd pEaCe" to uppercase: WAR AND PEACE
"wAr aNd pEaCe" to titlecase: War And Peace

*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からTextInfo.ToTitleCase メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からTextInfo.ToTitleCase メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からTextInfo.ToTitleCase メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

TextInfo.ToTitleCase メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TextInfo.ToTitleCase メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS