枋模:String split/doc

對HuaTaiLohankhapedia
Kàu tō-lám 跳至搜尋
  1. 重定向 Template:Uses Loa

-{H|zh-hans:重定向; zh-hant:閣再導向;}--{H|zh-cn:文字; zh-tw:字元;}--{H|zh-hans:文件; zh-hant:檔案;}--{H|zh-hans:快捷方式; zh-hant:捷徑;}--{H|zh-hans:項目; zh-hant:專案; zh-tw:計畫; zh-hk:計畫; zh-mo:計畫;}--{H|zh-cn:計算機; zh-sg:電腦; zh-tw:電腦;}-Lua 錯誤 於第53行的模組:Effective_protection_level中:attempt to index field 'TitleBlacklist' (a nil value)。 Template:String split is a convenience wrapper for the split function in Module:String2.

The split function splits text at boundaries specified by separator and returns the chunk for the index idx (starting at 1). It can use positional parameters or named parameters (but these should not be mixed):

  • {{#invoke:String2 |split |text |separator |index |true/false}}
  • {{#invoke:String2 |split |txt=text |sep=separator |idx=index |plain=true/false}}

Any double quotes (") in the separator parameter are stripped out, which allows spaces and wikitext like ["[ to be passed. Use {{!}} for the pipe character |.

If the optional plain parameter is set to false / no / 0 then separator is treated as a Lua pattern. The default is plain=true, i.e. normal text matching.

The index parameter is optional; it defaults to the first chunk of text. A negative parameter value counts chunks backward from the end of the text.