Mercurial > repos > IBBoard
diff Lang/StringManipulation.cs @ 110:a5714f82073d
* Add method for upper-casing just first character (based on DotNetPerls assertion that it is quicker this way)
* Make sure languages capitalise (Benoit spotted Microsoft don't capitalise their French language French)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 20 Jan 2012 20:50:25 +0000 |
parents | cc7fae81afec |
children |
line wrap: on
line diff
--- a/Lang/StringManipulation.cs Sat Sep 24 11:57:54 2011 +0100 +++ b/Lang/StringManipulation.cs Fri Jan 20 20:50:25 2012 +0000 @@ -61,6 +61,18 @@ int halfLength = strLength / 2; return stringToShorten.Substring(0, halfLength - diff)+"..."+stringToShorten.Substring(halfLength + diff); } + } + + public static string UpperFirst(string toUpper) + { + if (string.IsNullOrEmpty(toUpper)) + { + return string.Empty; + } + + char[] chars = toUpper.ToCharArray(); + chars[0] = char.ToUpper(chars[0]); + return new string(chars); } } }