Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make 1st letter of each word capital using c# code

Tags:

c#

//for e.g.

string s="this is example";

//how can i make output like "This Is Example"

using too simple code in c#??

like image 326
Neo Avatar asked Jan 06 '11 07:01

Neo


People also ask

How do you capitalize the first letter of each word in a string in c?

The toupper() function is used to convert lowercase alphabet to uppercase.

How do you make the first letter of each word capital?

To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.

How do you capitalize the first letter in C #?

h> int toupper(int c); int tolower(int c); DESCRIPTION toupper() converts the letter c to upper case, if possible. tolower() converts the letter c to lower case, if possible. If c is not an unsigned char value, or EOF, the behavior of these functions is undefined.

How can we print all the capital letters of a given string in c?

printf(“%c”,toupper(ch)); This printf() statement is printing the upper case value of the variable ch. This will be executed only when the above if statement becomes true.


1 Answers

Try this.

String s = "this is example";
Console.WriteLine(Thread.CurrentCulture.TextInfo.ToTitleCase(s));
like image 176
Chandu Avatar answered Nov 15 '22 04:11

Chandu