.NET API Documentation

System.Globalization.TextInfo

Provides culture-specific information about the case of strings, such as the case conversions, uppercase, lowercase, and title case.

Namespace

System.Globalization

Assembly

System.Runtime.dll

Inheritance

System.Object → System.Globalization.TextInfo

Syntax

public sealed class TextInfo

Constructors

ConstructorSummary
TextInfo()Initializes a new instance of the TextInfo class.

Properties

PropertyTypeSummary
ListSeparatorstringGets or sets the string that separates items in a list.
CultureNamestringGets the name of the culture associated with the TextInfo object.
IsReadOnlyboolGets a value indicating whether the TextInfo object is read-only.

Methods

MethodReturn TypeSummary
ToUpper(string)stringConverts the specified string to uppercase using the casing rules of the current culture.
ToLower(string)stringConverts the specified string to lowercase using the casing rules of the current culture.
ToTitleCase(string)stringConverts the specified string to title case (except for words that are entirely uppercase, which are unchanged).
Clone()objectCreates a shallow copy of the current TextInfo object.
ReadOnly(TextInfo)TextInfoReturns a read-only wrapper for the specified TextInfo object.

Example


// Create a TextInfo object for German culture
var germanCulture = new System.Globalization.CultureInfo("de-DE");
System.Globalization.TextInfo ti = germanCulture.TextInfo;

string lower = "strasse";
string upper = ti.ToUpper(lower); // "STRASSE"
string title = ti.ToTitleCase("ein kurzer satz"); // "Ein kurzer Satz"

Console.WriteLine($"Lower: {lower}");
Console.WriteLine($"Upper: {upper}");
Console.WriteLine($"Title: {title}");

See Also