Template:GetLevelRange/Preprocess: Difference between revisions

From HorizonXI Wiki
(Created page with "<includeonly><onlyinclude>{{#if:{{{1|}}}|<!-- if there is a minus in the input, take the part after the minus -->{{#if:{{#explode:{{{1}}}|-|1}}|{{#explode:{{{1}}}|-|1}}|<!-- if there is a plus at the end of the input, take everything but the plus -->{{#ifeq:{{#sub:{{{1}}}|-1}}|+|{{#sub:{{{1}}}|0|-1}}<!-- -->}}}}}}</onlyinclude></includeonly> ==Usage== Preprocessing Template for Template:GetLevelRange that is supposed to catch all exceptions that are not pure numbers...")
 
mNo edit summary
 
Line 3: Line 3:
-->{{#if:{{#explode:{{{1}}}|-|1}}|{{#explode:{{{1}}}|-|1}}|<!--
-->{{#if:{{#explode:{{{1}}}|-|1}}|{{#explode:{{{1}}}|-|1}}|<!--
if there is a plus at the end of the input, take everything but the plus
if there is a plus at the end of the input, take everything but the plus
-->{{#ifeq:{{#sub:{{{1}}}|-1}}|+|{{#sub:{{{1}}}|0|-1}}<!--
-->{{#ifeq:{{#sub:{{{1}}}|-1}}|+|{{#sub:{{{1}}}|0|-1}}|<!--
else just pass the argument through (could do a check if the expression is valid but that might be costly
-->{{{1}}}<!--
-->}}}}}}</onlyinclude></includeonly>
-->}}}}}}</onlyinclude></includeonly>
==Usage==
==Usage==
Line 14: Line 16:
<pre>{{GetLevelRange/Preprocess|55+}}</pre>
<pre>{{GetLevelRange/Preprocess|55+}}</pre>
{{GetLevelRange/Preprocess|55+}}
{{GetLevelRange/Preprocess|55+}}
<pre>{{GetLevelRange/Preprocess|55}}</pre>
{{GetLevelRange/Preprocess|55}}

Latest revision as of 11:44, 16 September 2024

Usage

Preprocessing Template for Template:GetLevelRange that is supposed to catch all exceptions that are not pure numbers but, e.g. "41-43" or "55+".

Examples

{{GetLevelRange/Preprocess|40-42}}

42

{{GetLevelRange/Preprocess|55+}}

55

{{GetLevelRange/Preprocess|55}}

55