Esempio n. 1
0
        public static string NameValueCollectionToString(LowerNameValueCollection attributes, char seperator)
        {
            if (attributes == null || attributes.Count <= 0)
            {
                return(string.Empty);
            }

            var builder = new StringBuilder();

            foreach (var key in attributes.Keys)
            {
                builder.Append(
                    $@"{StringUtils.ValueToUrl(key)}={StringUtils.ValueToUrl(attributes.Get(key))}{seperator}");
            }
            builder.Length--;
            return(builder.ToString());
        }
Esempio n. 2
0
        public static string ToAttributesString(LowerNameValueCollection attributes)
        {
            var builder = new StringBuilder();

            if (attributes != null && attributes.Count > 0)
            {
                foreach (var key in attributes.Keys)
                {
                    var value = attributes.Get(key);
                    if (!string.IsNullOrEmpty(value))
                    {
                        value = value.Replace("\"", "'");
                    }
                    builder.Append($@"{key}=""{value}"" ");
                }
                builder.Length--;
            }
            return(builder.ToString());
        }
Esempio n. 3
0
 public static string NameValueCollectionToString(LowerNameValueCollection attributes)
 {
     return(NameValueCollectionToString(attributes, '&'));
 }