제목 케이스는 제목이나 제목과 같이 주요 단어의 첫 글자가 대문자인 모든 텍스트입니다. 제목 케이스 또는 헤드라인 케이스는 출판된 작품 또는 예술 작품의 제목을 영어로 표시하는 데 사용되는 대문자 스타일입니다. 제목 케이스를 사용할 때 "소" 단어를 제외한 모든 단어는 대문자로 표시됩니다. 제목.
예제에서 ToTitleCase의 현재 구현은 입력 문자열과 동일한 길이의 출력 문자열을 생성합니다.
예시 1
class Program{
static void Main(string[] args){
string myString = "wAr aNd pEaCe";
TextInfo myTI = new CultureInfo("en-US", false).TextInfo;
Console.WriteLine("\"{0}\" to titlecase: {1}", myString, myTI.ToTitleCase(myString));
Console.ReadLine();
}
} 출력
"war and peace" to titlecase: War And Peace
예시 2
class Program{
static void Main(string[] args){
string[] values = {
"a tale of three cities", "gROWL rescue",
"inside the office", "sports and tennis",
"The Return of Christmas Holmes"
};
TextInfo ti = CultureInfo.CurrentCulture.TextInfo;
foreach (var value in values)
Console.WriteLine("{0} −−> {1}", value, ti.ToTitleCase(value));
Console.ReadLine();
}
} 출력
a tale of three cities −−> A Tale Of Three Cities gROWL rescue −−> Growl Rescue inside the office −−> Inside The Office sports and tennis −−> Sports And Tennis The Return of Christmas Holmes −−> The Return Of Christmas Holmes