# Make Numeric

Yate functions requiring numeric values convert the text at the start of a field to an integer. If an integer cannot be constructed, 0 is assumed. This function saves the results of the conversion ignoring extra characters after the integer. The function can read decimal integer sequences and Roman numeral sequences. The function can output the integer as a decimal integer or Roman numeral.

You specify a track or named variable to be converted. If a named variable is specified it may contain any of the escape sequences described in Escape Sequences.

The following functions are available:

as integer no padding
  A decimal integer is extracted and represented as is. eg. 4 Title --> 4
as integer padded to two digits
  A decimal integer is extracted. Positive integersescap in the range of 0 to 99 are represented as two digits. All other integers are represented as is. eg. 4 Title --> 04
as integer padded to three digits
  A decimal integer is extracted. Positive integers in the range of 0 to 999 are represented as three digits. All other integers are represented as is. eg. 4 Title --> 004
as integer padded to four digits
  A decimal integer is extracted. Positive integers in the range of 0 to 9999 are represented as four digits. All other integers are represented as is. eg. 4 Title --> 0004
as integer from Roman numeral
  A Roman numeral sequence is converted to a decimal integer. The string is treated as case insensitive and leading and trailing spaces are ignored. An invalid Roman numeral sequence will return 0. The conversion stops with the first non Roman numeral digit or the end of the string. Note that if the stopping character is alphanumeric, the sequence is treated as invalid. ie. Life will return 0, not 50. The alternative forms IIII, IIIII, XXXX, XXXXX, CCCC, CCCCC are permitted. eg. XIV --> 14.
as integer from boolean
  A text string of true (case insensitive) will return 1 otherwise an integer is extracted. If the value is non zero the field will be set to 1, otherwise 0.
as integer from negated boolean
  A text string of true (case insensitive) will return 0 otherwise an integer is extracted. If the value is non zero the field will be set to 0, otherwise 1.
As 1 or empty from boolean
  When extracting a numeric value, Yate typically treats non numeric text as being equivalent to 0. Rename Template's IfExists constructs, with a few exceptions, treat exists as non empty. When extending a rename template via an action you might wish to set up a track variable suitable for testing with an IfExists construct. A text string of true (case insensitive) will return 1 otherwise an integer is extracted. If the value is non zero the field will be set to 1, otherwise empty.
as integer from hexadecimal
  A decimal integer is returned by accumulating hexadecimal digits optionally preceded by a 0x sequence. The conversion stops with the first non hexadedimal digit (excluding the optional 0x sequence).
as boolean
  A text string of true (case insensitive) or any leading non zero value will return true, otherwise false.
from integer to Roman numeral
  A decimal integer is extracted and represented as a Roman numeral. Only positive integers in the range of 1 to 3999 can be represented. Any other value will be returned as an empty string. eg. 14 --> XIV
from integer to hexadecimal
  A decimal integer is extracted and returned as a hexadecimal value preceded by a 0x sequence.
from integer to hexadecimal display
  A decimal integer is extracted and returned as a sequence of 16 hexadecimal digits with a space separating every four digits.
from integer to binary display
  A decimal integer is extracted and returned as a sequence of 64 binary digits with a space separating every eight digits.
as alphabetic index
  If the first character in the source, ignoring alphabetic case and diacritic marks, is in the range of A through Z, a value of 1 through 26 is returned. Otherwise 0 is returned.
as Unicode character value
  The Unicode value of the first character is returned. If the source is empty, -1 is returned.