Template:IsNum

From FlightGear wiki
Jump to navigation Jump to search

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