跳转到内容

模板:Str left/doc:修订间差异

来自Tiancheng Wiki
twi_p>Kcx36
无编辑摘要
 
导入1个版本:​从Wikipedia导入
 
(没有差异)

2025年11月25日 (二) 16:21的最新版本

{{#if:

|

{{#if:x| | }} | {{#switch:doc| {{{override}}}| doc | Doc | documentation | Documentation | 文档 | 文件 = {{#ifeq:show| show|

}}{{#if:| | [[Category:{{#switch:模板|User=用户|Wikipedia=维基百科|Template=模板}}说明文件]]}}}}

}}

{{safesubst:#if:

|
|{{safesubst:#if:{{safesubst:#if:
|
|{{safesubst:#if:
 |
 |
}}

}}

 |
 |
}}

}}

本模板用于截取字符串的前n个字符。

使用方式

<syntaxhighlight lang="wikitext"></syntaxhighlight>

  • |{{#if:1|1=}} — 待截取的字符串
  • |{{#if:2|2=}} — 截取的字数(默认为1)

例子

  • <syntaxhighlight lang="wikitext" inline>底事崑崙傾砥柱</syntaxhighlight> → 底事崑崙傾砥柱
  • <syntaxhighlight lang="wikitext" inline>一</syntaxhighlight> →

模板數據

{{#if:| |以下是该模板的{{#if:|-{zh-cn:模板数据;zh-tw:模板資料}-|-{zh-cn:模板数据;zh-tw:模板資料}-}},适用于-{zh-cn:可视化编辑器;zh-tw:視覺化編輯器;}-等工具。}}

Str left-{zh-cn:模板数据;zh-tw:模板資料}-

{{#ifeq:doc|sandbox||

}} <templatedata> { "description": "顯示一串文字中的前幾個字", "params": { "1": { "label": "文字串", "description": "需要計算字數裁切的文字內容", "required": true, "type": "string" }, "2": { "label": "長度", "description": "希望顯示的字數", "required": true, "type": "number" } } } </templatedata>