| 12345678910111213141516171819202122232425262728 |
- using Newtonsoft.Json.Linq;
- using System;
- namespace YJMPD_UWP.Helpers
- {
- public static class Extensions
- {
- public static bool NullOrEmpty(this JToken token)
- {
- return (token == null) ||
- (token.Type == JTokenType.Array && !token.HasValues) ||
- (token.Type == JTokenType.Object && !token.HasValues) ||
- (token.Type == JTokenType.String && token.ToString() == String.Empty) ||
- (token.Type == JTokenType.Null);
- }
- public static string UppercaseFirst(this string s)
- {
- // Check for empty string.
- if (string.IsNullOrEmpty(s))
- {
- return string.Empty;
- }
- // Return char and concat substring.
- return char.ToUpper(s[0]) + s.Substring(1).ToLower();
- }
- }
- }
|