strrep()strrep()

将给定字符串重复提供的次数。Repeats given string provided amount of times.

  • 如果第一个或第三个参数不是字符串类型,则会将其强制转换为字符串。In case if first or third argument is not of a string type, it will be forcibly converted to string.

语法Syntax

strrep(value , multiplier ,[ delimiter ])strrep(value , multiplier ,[ delimiter ])

参数Arguments

  • value:输入表达式value : input expression
  • multiplier:正整数值(从 1 到 1024)multiplier : positive integer value (from 1 to 1024)
  • delimiter:可选字符串表达式(默认值:空字符串)delimiter : an optional string expression (default: empty string)

返回Returns

重复指定次数的值,使用 delimiter 进行连接。Value repeated for a specified number of times, concatenated with delimiter .

如果 multiplier 大于允许的最大值 (1024),则输入字符串将重复 1024 次。In case if multiplier is more than maximal allowed value (1024), input string will be repeated 1024 times.

示例Example

print from_str = strrep('ABC', 2), from_int = strrep(123,3,'.'), from_time = strrep(3s,2,' ')
from_strfrom_str from_intfrom_int from_timefrom_time
ABCABCABCABC 123.123.123123.123.123 00:00:03 00:00:0300:00:03 00:00:03