Skip to content

Function.stripTags

github-actions[bot] edited this page Jul 8, 2026 · 21 revisions

umt / stripTags

Function: stripTags()

stripTags(string_): string

Defined in: String/stripTags.ts:11

Removes HTML/XML tags from a string, keeping the text content. Unlike escapeHtml, which escapes special characters, this deletes the tags entirely. The removal repeats until the string is stable so that nested constructs (e.g. "<sc<script>ript>") cannot survive a single pass.

Parameters

string_

string

Input string

Returns

string

String with tags removed

Example

stripTags("<p>Hello <b>World</b></p>"); // "Hello World"

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally