TextInfo Class
System.Globalization
Provides information about and operations for the current culture, including case conversion, copying strings to the appropriate casing, and string comparison.
Members
CurrentCulture
public static TextInfo CurrentCulture { get; }
Gets a TextInfo object that provides culture-sensitive information about the current culture.
InvariantCulture
public static TextInfo InvariantCulture { get; }
Gets a TextInfo object that provides culture-sensitive information about the invariant culture.
Clone
public virtual object Clone()
Creates a new object that is a copy of the current instance.
IsLetter
public virtual bool IsLetter(char c)
Indicates whether the specified character is a letter.
IsDigit
public virtual bool IsDigit(char c)
Indicates whether the specified character is a digit.
ToTitleCase
public virtual string ToTitleCase(string str)
Converts the specified string to title case.
Example:
Converts a string to title case using the current culture's rules.
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
string titleString = "hello world example";
TextInfo textInfo = CultureInfo.CurrentCulture.TextInfo;
string titleCasedString = textInfo.ToTitleCase(titleString);
Console.WriteLine(titleCasedString); // Output: Hello World Example
}
}
ToLower
public virtual string ToLower(string str)
Converts the specified string to lowercase.
ToUpper
public virtual string ToUpper(string str)
Converts the specified string to uppercase.