Skip to main content

NumberType

The number should match a specific type.

Parameter table

paramunitrequireddescription
keyyesThe key of the number to check if it is of a specific type (key).
typenoThe type of the number. Options are: N, N*, Z, Z*, D.
decLimitnoThe maximum number of decimal places allowed for the number (decLimit).

How to setup

The rule verifies whether the number associated with the specified (key) is of a specific (type). If the number does not meet this criterion, the rule will fail.

The number type can be one of the following:

  • N: the set of positive integers with addition to 0 and extending indefinitely. In mathematical notation, they are often represented as ℕ = {0, 1, 2, 3, 4, ...}.

  • N*: the set of positive integers starting from 1 and extending indefinitely. In mathematical notation, they are often represented as ℕ* = {1, 2, 3, 4, ...}.

  • Z: the set of integers that includes all positive and negative whole numbers, as well as 0. In mathematical notation, the set is denoted as ℤ = {..., -2, -1, 0, 1, 2, ...}.

  • Z*:the set of integers including all positive and negative whole numbers and excluding 0. In mathematical notation, this set is denoted as ℤ* = {..., -2, -1, 1, 2, ...}.

  • D: Decimal numbers, or real numbers with decimal representations, include both rational and irrational numbers. They can be expressed in the form of a whole number followed by a decimal point and a series of digits. Examples of decimal numbers include 0.5, -3.14159, and 2.75.

For the decimal type, an optional parameter (decLimit) can be used to specify the allowed limit of decimal places.

Examples

valuevaliddecLimittypedescription
1NThe number should be a natural number.
-1ZThe number should be an integer.
1.1ZThe number should be an integer.
3N*The number should be a positive integer.
1.232DThe number should be a decimal number with a limit of 2 decimal places.
12DThe number should be a decimal number with a limit of 2 decimal places.
1.2342DThe number should be a decimal number with a limit of 2 decimal places.
-1N*The number should be a positive integer.
0Z*The number should be a positive/negative integer.
-1Z*The number should be a positive/negative integer.
1Z*The number should be a positive/negative integer.
-1NThe number should be a natural number.
1.1NThe number should be a natural number.
1.1DThe number should be a decimal number.
1DThe number should be a decimal number.