Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to come up with this output?If you enter a phrase or a sentence, the output will be the first and last letter of each word in uppercase format

Enter a phrase: the quick BROWN FOR JUMPS over the lazy dog.

Output
TE
QK
BN
FX
JS
OR
TE
LY
D.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this:

string Sentence = "Hello World";
string[] Words = Sentence.Split(' ');
string Result = "";

for (int i = 0; i < Words.Length; i++)
{
    Result += Words[i].Substring(0, 1).ToUpper() + Words[i].Substring(Words[i].Length - 1, 1).ToUpper() + " ";
}
MessageBox.Show(Result);

If my answer is useful, please mark it as accepted, and upvote it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading