repeat

Function repeat 

Source
pub fn repeat(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

重复字符串

§功能

将字符串重复指定的次数。

§参数

  • string: String - 要重复的字符串
  • count: Number - 重复次数(必须是非负整数)

§返回值

String - 重复后的字符串

§错误

  • 重复次数为负数或非整数时抛出错误

§示例

Set str "Ha"
Set laugh Repeat(str, 3)         # "HaHaHa"
Set dash "-"
Set line Repeat(dash, 10)        # "----------"
Set space " "
Set indent Repeat(space, 4)      # "    "