The UTL object and its methods
UTL object provides helper utilities.
UTL object can be used in the
SCRIPT attribute and also in the following functions, which are executed after disambiguation:
UTL object functionalities are exposed through its methods:
string_to_number method converts a number expressed in letters in a specified language into numbers and, if necessary, multiplied by a factor.
For example, the following instruction:
var strToNumber = UTL.string_to_number("EN", "onehundredseventyfive", "*M");
returns the value 175000000 in the string variable
strToNumber, that is 175 multiplied by 1000000.
The returned value, even if represented with numbers, is a string.
If the string to be converted is not a number, for example book is passed instead of onehundredseventyfive, the method returns 0.
The syntax is:
UTL.string_to_number(lang, string, adapt);
langis the used language. It can be:
- EN for English
- IT for Italian
- DE for German
- ES for Spanish
stringis the number expressed in letters to convert.
adaptis the multiplication factor, and it can assumes one the following values:
Value Multiplication factor blank 1 *K (kilo) 1x103 *M (mega) 1x106 *G (giga) 1x109 *T (tera) 1x1012 *m (milli) 1x10-3 *u (micro) 1x10-6 *n (nano) 1x10-9 *p (pico) 1x10-12
rebase_position method is used to rebase the items position (start and end) of a custom output. For example, when an
extradata key is returned in output, the position after the processing is not coincident with the source text.
Since Studio works on the text after a clean, the effect of this method isn't directly visible in this environment.
The syntax is:
index is the original position index.