模板:Trim quotes
跳转到导航
跳转到搜索
File:Test Template Info-Icon - Version (2).svg 模板文档[查看] [编辑] [历史] [清除缓存]
| File:Lua-Logo.svg | 此模板使用Lua语言: |
This template trims matched pairs of leading and trailing single (') and double (") quotes and whitespace from a string. The string should be passed as the first unnamed parameter or using |1= or |s= if your string contains any = signs.
参数及使用方法[编辑]
{{trim quotes|text}} = text with any leading or trailing quotes removed (as long as text doesn't contain any = signs).
{{trim quotes|1=text}} or {{trim quotes|s=text}} = text with any leading or trailing square brackets removed.
范例[编辑]
- <code>
{{trim quotes|1= 'abc' }}</code> producesabc.
- <code>
{{trim quotes|1= ""abc's""}}</code> producesabc's
- <code>
{{trim quotes|1= This is a "quote"}}</code> producesThis is a "quote"(since the quotes aren't at the beginning and end of the string)
模板编辑说明[编辑]
<templatedata> {
"description": "The template trims matched pairs of leading and trailing single and double quotes from a string.",
"params": {
"1": {
"label": "String",
"description": "The string to be trimmed",
"type": "string",
"required": true
}
}
} </templatedata>
参见[编辑]
- {{trim}}