Skip to content

@pmun/utils / replaceNBSP

Function: replaceNBSP()

ts
function replaceNBSP(str?): string;

替换字符串中的   为不换行空格

Parameters

str?

string

字符串

Returns

string

处理后的字符串

Example

ts
// 基本用法
replaceNBSP('John Doe') // 'John Doe'
replaceNBSP('Jane  Smith') // 'Jane  Smith'
replaceNBSP('Smith') // 'Smith'