Uppercase first letter of a string in C#
To uppercase the first letter of a string in C#, use:
Example
Input : bhaumik Patel
Output : Bhaumik Patel
public string UppercaseFirst(string s) { if (string.IsNullOrEmpty(s)) { return string.Empty; } char[] a = s.ToCharArray(); a[0] = char.ToUpper(a[0]); return new string(a); }
Example
Input : bhaumik Patel
Output : Bhaumik Patel
Uppercase first letter of a string in C#
Reviewed by Bhaumik Patel
on
1:27 AM
Rating: