Making the First letter of every word


using System;
using System.Globalization;

namespace Dharmaraj.CapitalizingLetters
{
internal class Program
{
static void Main(string[] args)
{
string textToTransform = "Dharmaraj,You need to submit more code snippets!";

Console.WriteLine("Original text: " + textToTransform);

//capitalizing the first letter of our text using the current culture
Console.WriteLine("Capitalize using the current culture: "
+ CultureInfo.CurrentCulture.TextInfo.ToTitleCase(textToTransform));

//capitalizing the first letter of our text using a defined culture
CultureInfo newCultureInfo = new CultureInfo("zh-Hans", false);
TextInfo textInfo = newCultureInfo.TextInfo;
Console.WriteLine("Capitalize using a specified culture: " + textInfo.ToTitleCase(textToTransform));

Console.Read();
}
}
}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: