Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public static string Capitalize(string inputValue)
  2. {
  3. if (String.IsNullOrEmpty(inputValue))
  4. return inputValue;
  5. string result = "";
  6. string[] words = inputValue.Split(' ');
  7.  
  8. foreach (string word in words)
  9. {
  10. if (word.Trim() != "")
  11. {
  12. if (word.Length > 1)
  13. result += word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower() + " ";
  14. else
  15. result += word.ToUpper() + " ";
  16. }
  17. }
  18. return result.Trim();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement