To Capitalized Word - CSharp System

CSharp examples for System:String Case

Description

To Capitalized Word

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*  ww w  .jav  a 2s  . com*/

public class Main{
        public static string ToCapitalized(this string token) {
         if (string.IsNullOrEmpty(token)) {
            return token;
         } else if (token.Length == 1) {
            return char.ToUpper(token[0]).ToString();
         } else {
            return char.ToUpper(token[0]) + token.Substring(1);
         }
      }
}

Related Tutorials