Шаблон:Join/doc
Материал из Википедии — свободной энциклопедии
Этот шаблон реализован на основе Lua с использованием модуля Separated entries. |
((join|строка 1|строка 2|...|separator=строка-разделитель))
объединяет несколько строк
, вставляя между парами строку-разделитель
. При этом, если хотя бы одна из строк пары пустая, то разделитель не используется (в этом и есть смысл шаблона).
Следует помнить, что, как и всегда, если в строках могут встречаться знаки равенства, следует напрямую указывать номера параметров:
((join |1=стро=ка=1 |2=стро=ка=2 |... |separator=<nowiki>, </nowiki> ))
.
Примеры использования
[править код]
Код | Результат |
---|---|
((join|1|2)) | 12 |
((join|1|2|separator=+)) | 1+2 |
((join||2|separator=+)) | 2 |
((join|1||separator=+)) | 1 |
((join|а|б|в|г|д|separator=<nowiki>, </nowiki>)) | а, б, в, г, д |
((join|а||в||д|separator=<nowiki>, </nowiki>)) | а, в, д |
((join|||в|г|д|separator=<nowiki>, </nowiki>)) | в, г, д |
((join|а||в|||separator=<nowiki>, </nowiki>)) | а, в |
Пример с переводом строки и знаком равенства в параметре:
Код | Результат |
---|---|
((join|1=abc = "foobar"; |2= |3=def = "blah-blah-blah"; |separator=<br>)) | abc = "foobar"; def = "blah-blah-blah"; |
См. также
[править код]- ((natural join))
- ((comma separated entries)) — заимствованный из английского раздела шаблон
Text is available under the CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.