更新时间:2022-11-12 09:24:11
string = string.replace(/\/$/, "");
$ 标记字符串的结尾。 \ / 是一个RegExp转义的 / 。结合两个= 替换行末尾的 / 。
$
\ /
/
$ marks the end of a string. \/ is a RegExp-escaped /. Combining both = Replace the / at the end of a line.
\/
正则表达式删除最后一个/如果它作为字符串中的最后一个字符存在