模板:Loop/doc

来自Local Chinese Wikipedia
imported>Whyiseverythingalreadyused2026年3月30日 (一) 02:28的版本 ({{#expr:2{{loop|50|*2}}}}换成{{#expr:2{{loop|3|*2}}}}应该会比较好理解)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

此模板透过调用String模块产生重复的字串,重复次数并无限制。

用法:{{loop|重複次數|需重複的字串}}

如果字符串包含等号,则必须在字串前加上“2=”。例如:

  • {{loop|9|2==}}显示=========(必须有“2=”)

用例:

  • {{loop|4|n}}显示nnnn
  • {{loop|25|test}}显示testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
  • {{#expr:2{{loop|3|*2}}}}显示16
  • {{loop|3|{{CURRENTYEAR}}}}显示202620262026

模板数据[编辑]

以下是该模板的模板数据,适用于可视化编辑器等工具。

Loop模板数据

<templatedata> { "params": { "1": { "label": "重复次数", "description": "字符串需重复的次数", "type": "number", "required": true }, "2": { "label": "字符串", "description": "需重复的字符串", "type": "string", "required": true } }, "description": "此模板用于产生重复的字符串", "paramOrder": [ "1", "2" ] } </templatedata>