FlowedToTextDeleteSpace Property

Get or set whether the trailing space on a wrapped line should be deleted.

Definition

Namespace: MimeKit.Text
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public bool DeleteSpace { get; set; }

Property Value

Boolean
if the trailing space on a wrapped line should be deleted; otherwise, .

Remarks

Gets or sets whether the trailing space on a wrapped line should be deleted.

The flowed text format defines a Content-Type parameter called "delsp" which can have a value of "yes" or "no". If the parameter exists and the value is "yes", then DeleteSpace should be set to , otherwise DeleteSpace should be set to .

Example

C#
                    public static string GetUnflowedText (TextPart part)
{
    // Text with a "format=flowed" Content-Type parameter (rfc3676) uses soft line breaks
    // so that the text can be re-wrapped by the receiving client. Convert it into normal
    // text by joining the flowed lines back into paragraphs.
    if (!part.IsFlowed)
        return part.Text;

    var converter = new FlowedToText ();

    // The "delsp" parameter specifies whether the space at the end of each flowed line
    // should be removed when the lines are joined.
    if (part.ContentType.Parameters.TryGetValue ("delsp", out string? delsp))
        converter.DeleteSpace = delsp.Equals ("yes", StringComparison.OrdinalIgnoreCase);

    return converter.Convert (part.Text);
}
                  

See Also