Can you code it better?
Code:public string ToProper(string src) { string[] s = src.Split(new char[] { ' ' }); string retval = String.Empty; int n = 0; foreach (string str in s) { if (str == String.Empty) { retval += " "; } else { retval += (str[0].ToString().ToUpper() + str.Substring(1, str.Length - 1).ToLower() + (n < s.Length - 1 ? " " : "")); } n++; } return retval; }




Reply With Quote