Try our conversational search powered by Generative AI!

Class WebStringHelper

Helper that removes all tags from specified string except tags marked as safe in 'EPiServer.Configuration.Settings.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: 11.20.7
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 'EPiServer.Configuration.Settings.UISafeHtmlTags' have been encoded and therefore will appear in the text instead of tags.

Remarks

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

Extension Methods