Share via


HeaderUtilities.EscapeAsQuotedString(StringSegment) Method

Definition

Escapes a StringSegment as a quoted-string, which is defined by the RFC specification.

public:
 static Microsoft::Extensions::Primitives::StringSegment EscapeAsQuotedString(Microsoft::Extensions::Primitives::StringSegment input);
public static Microsoft.Extensions.Primitives.StringSegment EscapeAsQuotedString (Microsoft.Extensions.Primitives.StringSegment input);
static member EscapeAsQuotedString : Microsoft.Extensions.Primitives.StringSegment -> Microsoft.Extensions.Primitives.StringSegment
Public Shared Function EscapeAsQuotedString (input As StringSegment) As StringSegment

Parameters

input
StringSegment

The input to be escaped.

Returns

An escaped version of the quoted-string.

Remarks

This will add a backslash before each backslash and quote and add quotes around the input. Assumes that the input does not have quotes around it, as this method will add them. Throws if the input contains any invalid escape characters, as defined by rfc7230.

Applies to