First Char To Upper Invariant - CSharp System

CSharp examples for System:Char

Description

First Char To Upper Invariant

Demo Code


using System;//from   w w w . ja v  a2  s  .c o m

public class Main{
        public static string FirstCharToUpperInvariant(this string value)
        {
            if (value == null)
                throw new ArgumentNullException(nameof(value));

            if (value.Length == 0)
                return value;

            return char.ToUpperInvariant(value[0]) + value.Substring(1);
        }
}

Related Tutorials