Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Utils
- {
- public static class Util
- {
- public static string UpperFirstChar(string s)
- {
- if (s == null) return null;
- if (s.Length == 1) return s.ToUpper();
- if (s.Length > 1) return char.ToUpper(s[0]) + s.Substring(1);
- return s;
- }
- public static string UpperWords(string s)
- {
- if (s == null) return null;
- return s.Split(' ')
- .Select(e => UpperFirstChar(e))
- .Aggregate((current, next) => current + " " + next);
- }
- }
- }
Add Comment
Please, Sign In to add comment