/// <summary>
 /// Read field parameters from the given field value
 /// </summary>
 /// <param name="fieldValue"></param>
 /// <returns></returns>
 public static IEnumerable <KeyValuePair <string, string> > Read(string fieldValue)
 {
     foreach (StringSegment parameter in StringSegment.Split(fieldValue, MimeFieldParameters.ParameterSeparator, MailStandard.DQUOTE))
     {
         yield return(ReadNameValue(parameter));
     }
 }
Example #2
0
 /// <summary>
 /// Splits a value by the supplied <paramref name="separator"/> <see cref="char"/>.
 /// </summary>
 /// <param name="headerText">The string to split.</param>
 /// <param name="separator">The <see cref="char"/> to split by.</param>
 /// <returns>The split <see cref="StringSegment"/> instances</returns>
 public override IEnumerable <StringSegment> SplitHeaderValue(string headerText, char separator)
 {
     return(StringSegment.Split(headerText, separator));
 }
Example #3
0
        // TODO: turn supplied code example into a unit test.

        /// <summary>
        /// Splits the supplied <see cref="StringSegment"/> by <paramref name="separator"/>, returning an enumeration of <see cref="StringSegment"/> instances for each header subpart.
        /// </summary>
        /// <param name="source">Segment to split.</param>
        /// <param name="separator">The value separator to split on.</param>
        /// <example>
        /// <code>
        /// StringSegment text = new StringSegment("a, b, c;d, e, f:g, e");
        /// IEnumerable&lt;StringSegment&gt; parts = Split(text, ',');
        /// foreach(StringSegment part in parts)
        /// {
        ///     Console.WriteLine(part);
        /// }
        /// // Prints:
        /// // a
        /// // b
        /// // c;d
        /// // e
        /// // f:g
        /// // e
        /// </code>
        /// </example>
        /// <returns>An enumeration of <see cref="StringSegment"/> instances, one for each parsed part.</returns>
        public static IEnumerable <StringSegment> Split(this StringSegment source, char separator)
        {
            return(StringSegment.Split(source, separator));
        }