Template:For Each Unique

From Ludlow Family Wiki
Revision as of 18:22, 24 June 2015 by Dan (talk | contribs) (Created page with "<noinclude>Apply a template to each non-repeating element of a list. Elements that are the same as the preceding element are skipped. (Elements that are repeated after somet...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Apply a template to each non-repeating element of a list. Elements that are the same as the preceding element are skipped. (Elements that are repeated after something else—e.g., "A, B, A"—will be repeated in the output. To get true deduplication, ensure that the list is sorted.)

  • First parameter: string to split
  • Second parameter: delimiter to search for; default is comma
  • Third parameter: replacement delimiter; default is the search delimiter, or comma+space if none
  • template: template to apply to each substring (string provided as first parameter; index provided as index)