Template:PropVals/Split

From Salem Wiki
Jump to: navigation, search

Head

Template documentation (for the template shown above, sometimes hidden or invisible)

Description

This template is used to split the parts of a property's value using a separator.
See these pages for documentation on functions used:

Syntax

Type the below code somewhere on a page:
{{PropVals/Split}}
It can accept 3 named-parameters:
  • val
    Mandatory; The value to split. Defaults to "Head;Middle;Tail"
  • part
    Optional; The part to fetch, and can be:
    'head' = Fetch first part. (default)
    'tail' = Fetch last part.
    a number = Fetch the #part, this number is directly used by the #explode: function and is Zero-based as explained in its documentation.
  • sep
    Optional; The separator to use for splitting parts. (defaults to a dot-colon ';')

Examples

  1. {{PropVals/Split}} and {{PropVals/Split|part=head}} gives:
    Head and Head
  2. {{PropVals/Split|part=-1}} and {{PropVals/Split|part=tail}} gives:
    Tail and Tail
  3. {{PropVals/Split|part=1}} gives:
    Middle
  4. {{PropVals/Split|val=A:B:C|sep=:}} gives:
    A
  5. {{PropVals/Split|val=A:B:C|sep=:|part=1}} gives:
    B
  6. {{PropVals/Split|val=A:B:C|sep=:|part=tail}} gives:
    C