TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to change the Title Case of a string to Uppercase in C#?
Francis
Feb 25
2015
Code
1.5
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System.Globalization;
using
System.Threading;
// The below function takes the string and split it using space and change the first character alone to //capital letter
// Input : i love india
// Output: I Love India
public
string
changeName(
string
inputname)
{
string
modifiedname =
string
.Empty;
string
[] names = inputname.Split(
' '
);
foreach
(
string
name
in
names)
{
CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo txtinfo = cultureInfo.TextInfo;
string
temp=txtinfo.ToTitleCase(name);
modifiedname =
string
.Concat(temp,
" "
);
}
return
modifiedname;
}
C#
Change Title case of string