CSharp examples for System:String Case
Capitalizes a word or sentence
using System.Text.RegularExpressions; using System.Text; using System.Globalization; using System.Collections.Generic; using System;/* ww w. j a v a2 s. c om*/ public class Main{ //Capitalizes a word or sentence //word -> Word //OR //this is a sentence -> This is a sentence public static string Capitalize(string input) { if (input.Length == 0) return ""; if (input.Length == 1) return input.ToUpper(); return input.Substring(0, 1).ToUpper() + input.Substring(1); } }