Template:Array implode

From Abulafia Random Generator Wiki
Jump to navigation Jump to search


This template simulates basic array functions. Arrays are accepted as strings, with each element separated by a pipe | As the the pipe is used to separate parameters, when manually creating an array you can use |.

This template has one required argument, a simulated array, and will return that array as a string with ", " separating each element. It can take an optional second argument if you wand a different glue, such as " + " instead of ", ", and an optional third argument if you want a different glue for the final addition, allowing "item1, item2 and item3"

Because arguments stril leading and trailing spaces, you will need to pass them using or use some other method to include whitespace.


{{Array_implode|item1|item2|item3}} → “item1, item2, item3”

{{Array_implode|item1|item2|item3|, }} → “item1,item2,item3”

{{Array_implode|item1|item2|item3|, }} → “item1, item2, item3”

{{Array_implode|item1|item2|item3|, | and }} → “item1, item2 and item3”