Another simple one. This makes sure that the first letter in a text is uppercase
Be the first to rate this post
July 15. 2008 01:16
If you were keen you could do this (note this is pseudo code if it doesn't compile public static string UpperFirstLetter(string str) { if (str == null) { // or throw exception return null; } switch (str.Length) { case 0: return str; case 1: return str.ToUpper(); default: return str.Substring(0, 1).ToUpper() + str.Substring(1, str.Length-1); } }
steveg
November 22. 2008 05:17
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2008
Sign in