Lowercase first letter of a string in C#

If you want to lowercase the first letter of a string in C# use:

public string LowercaseFirst(string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return string.Empty;
            }
            char[] a = s.ToCharArray();
            a[0] = char.ToLower(a[0]);

            return new string(a);
        }

Example

Input : Bhaumik Patel

Output : bhaumik Patel

Lowercase first letter of a string in C# Lowercase first letter of a string in C# Reviewed by Bhaumik Patel on 1:22 AM Rating: 5