When building large tables, speed is a concern, so Jamie Dixon's second function is best, but it doesn't work fully as it is ...
It is not possible to take all letters in lower case, and it uses only the first letter of the string, and not the first letter of each word in the string ... the option below fixes both problems:
public string UppercaseFirstEach(string s) { char[] a = s.ToLower().ToCharArray(); for (int i = 0; i < a.Count(); i++ ) { a[i] = i == 0 || a[i-1] == ' ' ? char.ToUpper(a[i]) : a[i]; } return new string(a); }
Although at the moment whether this is still the fastest option is uncertain, the Regex solution provided by George Mauer may be faster ... someone who needs it should test it.
Serj Sagan Aug 03 2018-12-12T00: 00Z
source share