Guest User

Untitled

a guest
Feb 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. namespace Utils
  2. {
  3. public static class Util
  4. {
  5. public static string UpperFirstChar(string s)
  6. {
  7. if (s == null) return null;
  8. if (s.Length == 1) return s.ToUpper();
  9. if (s.Length > 1) return char.ToUpper(s[0]) + s.Substring(1);
  10. return s;
  11. }
  12.  
  13. public static string UpperWords(string s)
  14. {
  15. if (s == null) return null;
  16. return s.Split(' ')
  17. .Select(e => UpperFirstChar(e))
  18. .Aggregate((current, next) => current + " " + next);
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment