다음을 통해 공유


SPEncode.HtmlEncodePreserveSpaces Method

Encodes the specified string so that special characters used in HTML are encoded as HTML entities but spaces are preserved.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Function HtmlEncodePreserveSpaces ( _
    str As String _
) As String
'Usage
Dim str As String
Dim returnValue As String

returnValue = SPEncode.HtmlEncodePreserveSpaces(str)
public static string HtmlEncodePreserveSpaces(
    string str
)

Parameters

Return Value

Type: System.String
The encoded version of the string that is passed to the method.

Remarks

Like the HtmlEncode method, the HtmlEncodePreserveSpaces method converts characters to entities as follows:

  • < to &lt;

  • > to &gt;

  • & to &amp;

  • " to &quot;

  • ' to &#39;

In addition, the HtmlEncodePreserveSpaces method also makes the following conversions to preserve spacing:

  • single space to &nbsp;

  • \n to <BR>

See Also

Reference

SPEncode Class

SPEncode Members

Microsoft.SharePoint.Utilities Namespace