Difference between revisions of "Template:PropVals/Split"

From Salem Wiki
Jump to: navigation, search
m (moved Template:Split PropertyVal to Template:PropVals/Split: Making part of a complex class)
m (Protected "Template:PropVals/Split": Key feature of wiki ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
 
(No difference)

Latest revision as of 18:13, 25 July 2012

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