模板:Loop/doc

維基百科,自由的百科全書
跳至導覽 跳至搜尋

此模板透過調用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>