String.repeat

String.repeat

String.repeat

功能

按次数重复当前字符串。

语法

参数

参数类型必填默认值说明
countInt0重复次数,负数会按 0 处理。

返回值

类型说明
String返回重复后的新字符串。

示例

注意事项

  • count 为 0 或负数时返回空字符串。