SaaS CMS has officially launched! Learn more now.

Class WebStringHelper

Helper that removes all tags from specified string except tags marked as safe in UISafeHtmlTags

Inheritance
System.Object
WebStringHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core.Html
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class WebStringHelper

Constructors

WebStringHelper()

Declaration
public WebStringHelper()

Methods

BuildRegularExpression(String[])

Creates a regular expression to be able to restore an array of html tags.

Declaration
public static string BuildRegularExpression(string[] safeTags)
Parameters
Type Name Description
System.String[] safeTags

The html tags that you want to appear as tags instead of encoded text.

Returns
Type Description
System.String

A regular expression to be able to restore an array of html tags.

EncodeForWebString(String)

Encodes a string to be displayed on a web page.

Declaration
public static string EncodeForWebString(string stringValue)
Parameters
Type Name Description
System.String stringValue

The string value.

Returns
Type Description
System.String

A string where all html tags except those defined in UISafeHtmlTags have been encoded and therefore will appear in the text instead of tags.

Remarks

The character '& will also be encoded to '&'.

Extension Methods