Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string Capitalize(string inputValue)
- {
- if (String.IsNullOrEmpty(inputValue))
- return inputValue;
- string result = "";
- string[] words = inputValue.Split(' ');
- foreach (string word in words)
- {
- if (word.Trim() != "")
- {
- if (word.Length > 1)
- result += word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower() + " ";
- else
- result += word.ToUpper() + " ";
- }
- }
- return result.Trim();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement