Template:IsNum: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (cat: Templates, Undocumented templates)
(+doc)
 
Line 1: Line 1:
{{#IfEq:{{{1|}}}|0|1|{{#IfEq:{{#Expr:{{{1|}}}/{{{1|}}}}}|1|1|0}}}}<noinclude>
{{#IfEq:{{{1|}}}|0|1|{{#IfEq:{{#Expr:{{{1|}}}/{{{1|}}}}}|1|1|0}}}}<noinclude>
{{Informative template|1=
__NOTOC__
== Goal ==
This template can be used when you want to see if a string is a number.
== Usage ==
Renders as "1" if a string is a number and "0" when not.
<nowiki>{{</nowiki>'''IsNum'''<nowiki>|</nowiki>''string''<nowiki>}}</nowiki>
; string:  String with possible number.  Numbers can have a trailing decimal point.  Decimal numbers must use decimal point.
== Examples ==
<nowiki>An empty sting is not a number: {{IsNum|}}</nowiki>
An empty sting is not a number: {{IsNum|}}
<nowiki>Three is a number: {{IsNum|3}}</nowiki>
Three is a number: {{IsNum|3}}
<nowiki>Trailing decimal point can be used: {{IsNum|3.}}</nowiki>
Trailing decimal point can be used: {{IsNum|3.}}
<nowiki>Decimal comma can not be used: {{IsNum|3,1}}</nowiki>
Decimal comma can not be used: {{IsNum|3,1}}
<nowiki>Decimal numbers can of course be used: {{IsNum|3.14}}</nowiki>
Decimal numbers can of course be used: {{IsNum|3.14}}
}}


[[Category:Templates]]
[[Category:Templates]]
[[Category:Undocumented templates]]
</noinclude>
</noinclude>

Latest revision as of 15:52, 24 May 2014

0


The following template description is not displayed when the template is inserted in an article.

Goal

This template can be used when you want to see if a string is a number.

Usage

Renders as "1" if a string is a number and "0" when not.

{{IsNum|string}}
string
String with possible number. Numbers can have a trailing decimal point. Decimal numbers must use decimal point.

Examples

An empty sting is not a number: {{IsNum|}}

An empty sting is not a number: 0


Three is a number: {{IsNum|3}}

Three is a number: 1

Trailing decimal point can be used: {{IsNum|3.}}

Trailing decimal point can be used: 1


Decimal comma can not be used: {{IsNum|3,1}}

Decimal comma can not be used: 0


Decimal numbers can of course be used: {{IsNum|3.14}}

Decimal numbers can of course be used: 1