UNPKG
js-wrench
Version:
latest (1.3.1)
1.3.1
1.3.0
1.2.2
1.2.1
JS函数库
js-wrench
/
modules
/
rtrim.ts
13 lines
(12 loc)
•
342 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
/** *
@description
对字符串右边去空格 * *
@param
{
string
} str 传入一个字符串 *
@return
{
*
} {
string
} 返回一个右边没有空格的新的字符串 *
@example
rtrim(" bac ") => " bac" */
const
rtrim = (
str
:
string
):
string
=>
{
let
reg
:
RegExp
=
/\s*$/
return
str.
replace
(reg,
''
) }
export
default
rtrim