SoftadminUtil.String_StripHtmlTag

Type: Scalar function

This function removes all occurrences of a specified HTML tag from a supplied string. Typical usage could for example be to remove unwanted or dangerous tags from the HTML body of an email message before displaying said message on an HTML page.

Use the additional bit-arguments to specify whether the tag should be treated as self closing, or when not self closing, whether the tags inner-HTML should be removed together with the tag.

Note:
The special case of a null-string will give a return value of null.

Return value: nvarchar(max)

The processed string.

Parameters

@String mandatory nvarchar(max)
The string to process.
@Tag mandatory nvarchar(300)
The type of tag to remove, i.e. specify 'br' to remove all "<br>"-tags etc.
@IsSelfClosing mandatory bit
Specifies whether the tag should be considered self closing or not.
@StripInnerHtml mandatory bit
Used together with tags that are not self closing to specify whether any inner html should be stripped away together with the tag itself.