summaryrefslogtreecommitdiffstats
path: root/source/rainerscript/functions/rs-cnum.rst
blob: 055a3437638570423174bd576ab35bccab246cf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
******
cnum()
******

Purpose
=======

cnum(expr)

Converts expr to a number (integer).

.. note::

   If the expression does not contain a numerical value, the following
   rule applies: the best match as the number is returned. For example
   "1x234" will return the number 1 and "Test123" will return 0. Zero is
   always returned if the there is no number at the start of the string.
   This also is the case for empty strings.


Example
=======



.. code-block:: none

   cnum(3+2);

produces

.. code-block:: none

   5