UNPKG

@zstings/utils

Version:

javascript、typescript 工具函数库 文档地址 [utils 文档](https://zstings.github.io/utils/)

22 lines (21 loc) 600 B
/** * 移除字符串中的html标签 * @param str 传入参数, 如果参数不是字符串,会先调用toString方法 * @return 字符串 * @category 字符串String * @example * ```ts * removeHTML('<p>这是<em>一个</em>段落。</p>') // => 这是一个段落。 * ``` * @example * 转义符也会被去除 * ```ts * removeHTML('<p>这是<em>一个</em>段落。&nbsp;</p>') // => 这是一个段落。 * ``` * @example * 参数不是字符串,会先调用toString方法 * ```ts * removeHTML(true) // 'true' * ``` */ export default function removeHTML(str: any): string;