User:Mathglot/sandbox/Templates/Nth slash
Appearance
Documentation
Return Nth expression split by slash, or 1st item, if no N index given.
Usage
{{Nth slash|3|String one / two / and three}}
Parameters
|1=
– the N index; if N=2, returns the second expression (i.e., after the first slash). Default: 1; alias:|N=
.|2=
– a string, optionally containing slash separators (with or without leading/trailing blanks, which are ignored)
Examples
{{Nth slash|2|one / two / and three}}
⟶ Draft:Nth slash{{Nth slash|1|one two three}}
⟶ Draft:Nth slash{{Nth slash|2|one two three}}
⟶ Draft:Nth slash{{Nth slash|3|one / two / and three}}
⟶ Draft:Nth slash{{Nth slash|7|one / two / and three}}
⟶ Draft:Nth slash