TextInfo class provides very useful string casing
functions. These functions can be used to change case of a string into
- Lower Case
- Upper Case and
- Title Case
TextInfo class is available under
System.Globalization namespace. TextInfo object can be
initiated from CultureInfo by using following ways.
- CultureInfo.CurrentCulture.TextInfo
- new CultureInfo("en-US",false).TextInfo
String to Lower Case:
TextInfo class provides ToLower function to convert
a string into lower case. Its usage is illustrated in code snippet available in
end of this article.
String to Upper Case:
TextInfo class provides ToUpper function to convert
a string into lower case. All characters in string are converted into upper
case. Its usage is illustrated in code snippet available in end of this
article.
String to Title Case:
TextInfo class provides ToTitleCase function to
convert a string into a Title case. It converts first character of each word into
upper case and remaining characters of each word into lower case. Its usage is
illustrated in code snippet available in end of this article.
Code
Output


No comments:
Post a Comment