Mercurial > repos > IBBoard
comparison 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 |
comparison
equal
deleted
inserted
replaced
109:93081f4df6b8 | 110:a5714f82073d |
---|---|
60 int diff = (strLength - length) / 2; | 60 int diff = (strLength - length) / 2; |
61 int halfLength = strLength / 2; | 61 int halfLength = strLength / 2; |
62 return stringToShorten.Substring(0, halfLength - diff)+"..."+stringToShorten.Substring(halfLength + diff); | 62 return stringToShorten.Substring(0, halfLength - diff)+"..."+stringToShorten.Substring(halfLength + diff); |
63 } | 63 } |
64 } | 64 } |
65 | |
66 public static string UpperFirst(string toUpper) | |
67 { | |
68 if (string.IsNullOrEmpty(toUpper)) | |
69 { | |
70 return string.Empty; | |
71 } | |
72 | |
73 char[] chars = toUpper.ToCharArray(); | |
74 chars[0] = char.ToUpper(chars[0]); | |
75 return new string(chars); | |
76 } | |
65 } | 77 } |
66 } | 78 } |