模板:Str rightc/doc

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

用法[編輯]

{{str rightc|<字符串>|<长度>}}
{{str rightc|<字符串>|<长度>|<空字符串结果>}}

返回字串右側指定長度的字元子串。如果提供了<空字串結果>參數,則當字串為空時返回該值。

範例[編輯]

  • {{str rightc |Lorem ipsum dolor sit amet |10}} → r sit amet
  • {{str rightc |Lorem ipsum dolor sit amet |1}} → t
  • {{str rightc |Lorem ipsum dolor sit amet |0}}
  • {{str rightc | |1 |string is empty}} → string is empty
  • {{str rightc |123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1 |99}} → 3456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-1

模板資料[編輯]

以下是該模板的模板資料,適用於視覺化編輯器等工具。

Str rightc模板資料

<templatedata> { "description": "返回字串最右側指定數量的字元。", "params": { "1": { "label": "字串", "description": "待處理的字串", "type": "string", "required": true }, "2": { "label": "數量", "description": "從右側返回的字元數量", "type": "number", "required": true }, "3": { "label": "空字串結果", "description": "當字串為空時返回的結果", "type": "string", "required": false } } } </templatedata>

參見[編輯]