模板: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>

参见[编辑]