Lowers the case of the first char. - CSharp System

CSharp examples for System:String Case

Description

Lowers the case of the first char.

Demo Code


using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Text;
using System;//from www  .java 2s.co m

public class Main{
        /// <summary>
        /// Lowers the case of the first char.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static string LowerCaseFirstChar(string name)
        {
            if (name.Length >= 1 && char.IsUpper(name[0]))
            {
                char[] chars = name.ToCharArray();
                chars[0] = Char.ToLower(chars[0]);
                return new string(chars);
            }
            return name;
        }
}

Related Tutorials