Convert first character to lower. - CSharp System

CSharp examples for System:String Convert

Description

Convert first character to lower.

Demo Code


using System;//from   w  w w.j av a 2 s  .  co m

public class Main{
        /// <summary>
        /// Convert first character to lower.
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string FirstCharacterToLower(this string str)
        {
            if (String.IsNullOrEmpty(str) || Char.IsLower(str, 0))
            {
                return str;
            }

            return Char.ToLowerInvariant(str[0]) + str.Substring(1);
        }
}

Related Tutorials