Template:NumChoirs: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(counts the number of choirs in a voicing ... eg. {{NumChoirs|SSAT.SATB.ATBB}} = 3)
 
(better, more compact code, no limits on number of choirs)
Line 1: Line 1:
{{#expr: {{#if:{{#explode: {{{1|}}}|.|0}}|1|0}}
<includeonly>{{#expr:{{#len:{{{1|}}}}}-{{#len:{{#replace:{{{1|}}}|.|}}}}+1}}</includeonly><noinclude>
+ {{#if:{{#explode: {{{1|}}}|.|1}}|1|0}}
+ {{#if:{{#explode: {{{1|}}}|.|2}}|1|0}}
+ {{#if:{{#explode: {{{1|}}}|.|3}}|1|0}}
+ {{#if:{{#explode: {{{1|}}}|.|4}}|1|0}}
+ {{#if:{{#explode: {{{1|}}}|.|5}}|1|0}}
}}<noinclude>
[[Category:Templates|{{PAGENAME}}]]
[[Category:Templates|{{PAGENAME}}]]
{{prot-temp}}
{{prot-temp}}
Line 11: Line 5:
|'''Usage:''' Returns the number of choirs in a voicing specification.  Thus,
|'''Usage:''' Returns the number of choirs in a voicing specification.  Thus,
<pre>{{NumChoirs|SA.TB.ATB}}</pre>
<pre>{{NumChoirs|SA.TB.ATB}}</pre>
returns 3.  The template will handle 1,2,3,4,5 and 6 choir voicings.
returns 3.
}}
}}

Revision as of 03:43, 27 June 2010

Usage: Returns the number of choirs in a voicing specification. Thus,

{{NumChoirs|SA.TB.ATB}}

returns 3.