SPHttpUtility.HtmlEncodeAllowSimpleTextFormatting method (String)

Encodes the specified string for use as text between HTML tags, preserving spaces in the original string and allowing simple text formatting.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Shared Function HtmlEncodeAllowSimpleTextFormatting ( _
    valueToEncode As String _
) As String
'Usage
Dim valueToEncode As String
Dim returnValue As String

returnValue = SPHttpUtility.HtmlEncodeAllowSimpleTextFormatting(valueToEncode)
public static string HtmlEncodeAllowSimpleTextFormatting(
    string valueToEncode
)

Parameters

Return value

Type: System.String
The encoded string.

Remarks

The HtmlEncodeAllowSimpleTextFormatting method:

  • Replaces ampersand, double-quotation, single-quotation, less-than, and greater-than characters with the appropriate entity references.

  • Replaces space characters preceded by a newline character or followed by another space character with " " entity references.

  • Replaces newline characters with HTML "<br>" tags.

  • Replaces carriage-return characters with space characters.

"<br>", "<b>", "<i>", "<u>", "</b>", "</i>", and "</u>" HTML tags and " " entity references in the specified string are permitted and not encoded. These allowed HTML tags and entity reference are case sensitive.

See also

Reference

SPHttpUtility class

SPHttpUtility members

HtmlEncodeAllowSimpleTextFormatting overload

Microsoft.SharePoint.Utilities namespace