Couple of days ago I got requirement of make first character of a string upper case in asp.net. I found but unable to get any built-in function available in .net so after some sort of coding, I develop my own function.
public static string MakeFirstCharUpper(string inputstring) { if (String.IsNullOrEmpty(inputstring)) throw new ArgumentException("ARGH!"); return inputstring.First().ToString().ToUpper() + String.Join("",inputstring.ToLower().Trim().Skip(1)); }
So that’s it. Just you have to call this function and you will get desired output.
Happy Coding!!!
0 comments:
Post a Comment