TextInfo.ToTitleCase メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As TextInfo Dim str As String Dim returnValue As String returnValue = instance.ToTitleCase(str)
戻り値
タイトル文字に変換するために指定する文字列。


タイトル文字に変換することにより、通常、単語の最初の文字が大文字に変換され、残りの文字は小文字に変換されます。ただし、略語などのすべて大文字の単語は変換されません。
ToTitleCase メソッドの現在の実装では、入力文字列と同じ長さの出力文字列が生成されます。ただし、この動作は保証されず、将来の実装で変更される可能性があります。
大文字/小文字の変換の詳細については、『Unicode Technical Report #21』の「Case Mappings」を参照してください。

"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 */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTextInfo.ToTitleCase メソッドを検索する場合は、下記のリンクをクリックしてください。

- TextInfo.ToTitleCase メソッドのページへのリンク