UppercaseFirstLetter

public static string UppercaseFirstLetter(this string value)
    {
	//
	// Uppercase the first letter in the string.
	//
	if (value.Length > 0)
	{
	    char[] array = value.ToCharArray();
	    array[0] = char.ToUpper(array[0]);
	    return new string(array);
	}
	return value;
    }
Example:
string value = "dot net perls";
value = value.UppercaseFirstLetter();

//Return "Dot net perls"

Description

Upper case first letter

Details

  • Author: Luã Govinda
  • Submitted on: 6/11/2015 10:07:08 PM
  • Language: C#
  • Type: C#
  • Views: 1145

Double click on the code to select all.

 

;