Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to change the Title Case of a string to Uppercase in C#?
WhatsApp
Francis
Feb 25
2015
1.6
k
0
0
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
Up Next
How to change the Title Case of a string to Uppercase in C#?