Listed below are all Clover ETL TL language functions which are part of the standard release.
(since 2.4)
Converts string containing BASE64 encoded data into binary representation - bytearray.
Syntax
bytearray base64byte(string src);
Attributes
Return type
Exception
Example
string stringBase='aGVsbG93b3JsZA=='; bytearray bytes=base64byte(stringBase);
Converts an array of bits to a string. It is a counterpart of the str2bits() function. The function converts each byte(8bits) of byte array to 8 characters. The bit 1 is character '1', bit 0 is character '0'. The first character represents the lowest bit (i.e.: 2 = '010000000').
Syntax
Attributes
Return type
Exception
Example
bits2str(str2bits("0010001010100010")) returns '0010001010100010' bits2str(str2bits("ab1cde1f1g1hij1")) returns '0010001010100010'
(since 2.4)
Converts boolean to requested numeric type, true is converted to 1 and false to 0;
Syntax
numeric bool2num(boolean from);
numeric bool2num(boolean from, type type);
Attributes
Return type
Exception
Example
decimal(20,10) mydec = bool2num(false,decimal) returns 0E-10
Converts an array of bytes to its BASE64 representation. It is a counterpart of the base64byte() function.
Syntax
string byte2base64(bytearray arg);
Attributes
Return type
Example
byte2base64(helloworld) returns 'aGVsbG93b3JsZA=='
Converts an array of bytes to its hexadecimal representation. It is a counterpart of the hex2byte() function. It returns 2 characters for each byte of the byte array (e.g.: [68, 69] = [0100 0100, 0100 0101] = 4445).
Syntax
string byte2hex(bytearray arg);
Attributes
Return type
Example
byte2hex(a) returns 61
(since 2.4)
Converts date to long representing the number of milliseconds since January 1, 1970, 00:00:00 GMT.
Syntax
Attributes
Return type
Exception
Example
date2long($Born)
Returns value of given “field” (for month the value is from range 0-11). Remember that time units (“field”) must be specified as constants in the function! They can neither be received as field values nor be defined as variables.
Syntax
int date2num(date date_arg, enum field);
Attributes
Return type
Exception
Example
d=2001-12-20; date2num(d,month) returns 11
Returns string representation of “date” in format given by “pattern”. For complete rules see documentation of java.text.SimpleDateFormat.
Syntax
string date2str(date date,string pattern);
Attributes
Return type
Exception
Example
date2str(2002-12-24, 'dd.MM.yyyy') returns '24.12.2002'
Converts a string in hexadecimal representation to an array of bytes. It is a counterpart of the byte2hex() function. It returns a byte for each 2 hex(0-9a-f) characters (e.g.: '4445' = [0100 0100, 0100 0101] = [68, 69]).
Syntax
bytearray hex2byte(string arg);
Attributes
Return type
Example
hex2byte('61') returns a
(since 2.4)
Converts long to date and sets it to a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.
Syntax
Attributes
Return type
Exception
Example
long2date(1212343127451l) returns Sun Jun 01 19:58:47 CEST 2008;
(since 2.4)
Converts numeric representing 0 (false) or 1 (true) to boolean.
Syntax
boolean num2bool(numeric from);
Attributes
Return type
Exception
Example
boolean mybool = num2bool(1);
(since 2.4)
Converts numeric to another numeric. Conversion is successful if and only if requested value can be converted to requested type without any information loss.
Syntax
numeric num2num(numeric from, type type);
Attributes
Return type
Exception
Example
int i; double d =32; i = num2num(d,int);
Returns string representation of “num” in “radix” based system or (since 2.6.1 ver.) formatted due to given format.
Syntax
string num2str(numeric num);
string num2str(numeric num, int radix);
string num2str(numeric num, string format);
Attributes
Return type
Exception
Example
num2str(2.5e-1) returns '0.25' num2str(10) returns '10' num2str(10, 8) returns '12' num2str(1.0000) returns '1.0' num2str(1247,'¤###,000.00') returns '$1,247.00'
Converts a string to an array of bits. It is a counterpart of the bits2str function. The function convertes each 8 characters to 1B (8bits). The character '1' is 0, other characters are 0 in the byte array. The first character represents the lowest bit (i.e.: '01000000' = 2). If the string size is shorter than 8, the rest of characters are '0'.
Syntax
bytearray str2bits(string arg);
Attributes
Return type
Exception
Example
str2bits("001000101010001") returns [68, 69] // byte array str2bits("ab1cde1f1g1hij1k") returns [68, 69] // byte array
(since 2.4)
Converts string to boolean. For successful conversion string must match to default "true" or "false" format.
Syntax
boolean str2bool(string from);
Attributes
Return type
Exception
Example
boolean mybool=str2bool('true'); boolean mybool=str2bool('0');
Returns date which has string representation given by “pattern”.
Syntax
date str2date(string date, string pattern);
Attributes
Return type
Exception
Example
str2date('20070101', 'yyyyMMdd') returns date
From ver. 2.4
Returns date which has string representation given by pattern and locale. With lenient argument set to true, convertor may use heuristics to interpret inputs that do not precisely match this object's format. With strict converting, inputs must match this object's format. First two arguments are necessary; when there are only three arguments, third argument is treated as locale if it is of type string or as lenient if it is of type bool.
Syntax
date str2date(string date, string pattern, string locale, bool lenient);
Attributes
Example
str2date('20July 2000','ddMMMyyyy','en.GB') returns date str2date('20-15-2000','dd-MM-yyyy','en.GB',true) returns date str2date('20-15-2000','dd-MM-yyyy','en.GB',false) throws TransformLangExecutorRuntimeException: Interpreter runtime exception : str2date - can't convert ...
Parses the string argument as a signed number in the radix specified by the third argument. Default return value is int and radix is 10. For types other then int, second argument must be given.
Syntax
number str2num(string str);
type str2num(string str, enum type);
type str2num(string str, enum type, number radix);
type str2num(string str, enum type, string pattern);
type str2num(string str, enum type, string pattern, string locale);
Attributes
0x are hexadecimal string representation of a number.Return type
Exception
Example
decimal n = str2num('2.5e-1',decimal) returns n = 0.25 int m = str2num('2.5e-1') throws TransformLangExecutorRuntimeException: Interpreter runtime exception : str2num - can't convert "2.5e-1" n = str2num("1,005.46$",decimal,"#,###.00¤","en.US")
(since 2.4)
Returns string representation of argument.
Syntax
string to_string(any_type from);
Attributes
Return type
Exception
Example
to_string(myVariable); to_string($Born);
(since 2.9)
Returns name of i-th (0 based) field of passed-in record. If the field with given index doesn't exist, empty string is returned.
Syntax
string get_field_name(record record, numeric index);
Attributes
Return type
Exception Interpreter runtime exception on line 7 column 34 : get_field_name - - wrong type of literals - if the 1st argument is not record and the 2nd one is not numeric
Example
get_field_name(@0,0); - returns name of 0th field from 0th input
(since 2.9)
Returns data type of i-th (0 based) field of passed-in record. If the field with given index doesn't exist, empty string is returned.
Syntax
string get_field_name(record record, numeric index);
Attributes
Return type
Exception Interpreter runtime exception on line 7 column 34 : get_field_type - - wrong type of literals - if the 1st argument is not record and the 2nd one is not numeric
Example
get_field_type(@input,1); - returns type of 1th field from input data record with "input" record name
(since 2.4)
Tries to convert variable from one type to another. It returns either the converted value (on successful conversion) or a null value on failure. Third argument is optional and is used when converting from/to string.
Syntax
any try_convert(any from, type targetType, string format);
Attributes
Return type
Exception
Example
string stringNo='12'; try_convert(stringNo, int) returns 12 stringNo='15a'; try_convert(stringNo, int) returns null date d; d=try_convert('20.9.2007',date,'dd.MM.yyyy');
returns a date later (earlier) from “start” date for “amount” of time units described by “field”. Remember that time units must be specified as constants in the function! They can neither be received as field values nor be defined as variables.
Syntax
date dateadd(date start, numeric amount, enum field);
Attributes
Return type
Exception
Example
dateadd(2006-01-01, 14, month) returns 2007-03-01 dateadd(2006-01-30, -2, day) returns 2006-01-28
Returns difference between two dates in time units described by “field”. If “later” is after “earlier” the result is positive else it is negative. Remember that time units must be specified as constants in the function! They can neither be received as field values nor be defined as variables.
Syntax
int datediff(date later, date earlier, enum field);
Attributes
Return type
Exception
Example
datediff(1946-04-01, 2006-01-01, year) returns -60
(since 2.7)
Returns a random date and time. The date and time can even take the values of the specified arguments “from” and/or “to”. Remember, however, that each date (like for example: 2002.03.29) represents the beginning of the date. In other words, it equals to the same date in which hours, minutes, seconds, and milliseconds are 0. (In this case, 2002.03.29 00:00:00 000). For this reason, if you want that such a date (2002.03.29) can be returned by the random_date() function, you should set the “to” margin to the next day (2002.03.30.).
Syntax
date random_date(date from, date to);
date random_date(long from, long to);
date random_date(date from, date to, long randomSeed);
date random_date(long from, long to, long randomSeed);
date random_date(string from, string to, string format);
date random_date(string from, string to, string format, string locale);
date random_date(string from, string to, string format, long randomSeed);
date random_date(string from, string to, string format, string locale, long randomSeed);
Attributes
or
Return type
Exception
Example
random_date(today(), dateadd(today(),20,day)) random_date(today(), dateadd(today(),20,day),0) random_date("2009-01-01", "2009-02-01","yyyy-MM-dd") random_date("2009-01-01", "2009-02-01","yyyy-MM-dd",0) random_date("2009-01-01", "2009-02-01","yyyy-MM-dd","US") random_date("2009-01-01", "2009-02-01","yyyy-MM-dd","US",0)
Returns current date and time.
Syntax
date today();
Attributes
Return type
Exception
Example
today() returns date
Returns truncation of “arg”. For numeric types it is long part of “arg”, for date type it is the date with the same year,month and day, but hour, minute, second and millisecond are set to zero values. In case of list or map parameter, the effect is emptying the list or map passed in and the return value is null.
Syntax
long trunc(numeric arg);
date trunc(date arg);
trunc(list arg);
trunc(map arg);
Attributes
Return type
Exception
Example
trunc(1.54) returns 1 list mylist; mylist[]=1; mylist[]=2; trunc(mylist); returns null, length(mylist)==0;
Returns the date with the same hour, minute, second and millisecond, but year, month and day are set to zero values. Zero date value is 0001-01-01.
Syntax
Attributes
Return type
Returns absolute value of “arg”.
Syntax
Attributes
Return type
Exception
Example
abs(-2.3) returns 2.3
(since 2.7)
The function accepts two arguments. Both are of any numeric data type. It takes their integer parts and returns a long value. This long is the result of bitwise “and”.
Syntax
long bit_and(numerictype arg1,numerictype arg2);
Attributes
Return type
Example
bit_and(11,7) returns 3;
(since 2.7)
The function accepts two arguments. Both are of any numeric data type. It takes their integer parts and returns a boolean true or false if the bit in bitwise representation of the first argument that is located on the position specified by the Index is 1 or 0, respectively. Bits are indexed starting from 0 from the right side of the bitwise representation of the number. Thus, if Index is 0, it corrrespond to the first bit on the right side.
Syntax
boolean bit_is_set(numerictype arg,numerictype Index);
Attributes
Return type
Example
bit_is_set(11,0) returns true, bit_is_set(11,1) returns true, bit_is_set(11,2) returns false;
(since 2.7)
The function accepts two arguments. Both are of any numeric data type. It takes the integer parts of both of them and adds the number of bits (each is set to 0) that is specified as the second argument to the right side of the bitwise representation of the first argument.
Syntax
long bit_lshift(numerictype arg,numerictype Shift);
Attributes
Return type
Example
bit_lshift(11,1) returns 22;
(since 2.7)
The function accepts two arguments. Both are of any numeric data type. It takes their integer parts and returns a long value. This long is the result of bitwise “or”.
Syntax
long bit_or(numerictype arg1,numerictype arg2);
Attributes
Return type
Example
bit_or(11,7) returns 15;
(since 2.7)
The function accepts two arguments. Both are of any numeric data type. It takes the integer parts of both of them and removes the number of bits that is specified as the second argument from the right side of the bitwise representation of the first argument.
Syntax
long bit_rshift(numerictype arg,numerictype Shift);
Attributes
Return type
Example
bit_rshift(11,1) returns 5;
(since 2.7)
The function accepts three arguments. The first two are of any numeric data type. The third is boolean. It takes the integer parts of the first two arguments and sets the bit in bitwise representation of the first argument that is located on the position specified by the Index to 1 or 0, if the third argument is true or false, respectively, and returns the number as long value. Bits are indexed starting from 0 from the right side of the bitwise representation of the number. Thus, if Index is 0, it corrrespond to the first bit on the right side.
Syntax
long bit_set(numerictype arg,numerictype Index, boolean SetBitTo1);
Attributes
Return type
Example
bit_set(11,0,false) returns 10, bit_set(11,1,false) returns 9, bit_set(11,2,true) returns 15;
(since 2.7)
The function accepts two arguments. Both are of any numeric data type. It takes their integer parts and returns a long value. This long is the result of bitwise “exclusive or”.
Syntax
long bit_xor(numerictype arg1,numerictype arg2);
Attributes
Return type
Example
bit_xor(11,7) returns 12;
The function returns e. The double value that is closer than any other to e, the base of the natural logarithms.
Syntax
number e();
Attributes
Return type
Exception
Example
e() returns 2.7182818284590452354;
Returns exponent of “arg”.
Syntax
Attributes
Return type
Exception
Example
exp(1) returns e^1 = 2.71828182845905
Returns natural logarithm (base e) of “arg”, -Infinity if “arg” equals zero or NaN if “arg” is less then zero.
Syntax
Attributes
Return type
Exception
Example
// e is euler number log(e) returns 1;
Returns base 10 logarithm of “arg”, -Infinity if “arg” equals zero or NaN if “arg” is less then zero.
Syntax
Attributes
Return type
Exception
Example
log10(10) returns 1;
The function returns π. The double value that is closer than any other to π, the ratio of the circumference of a circle to its diameter.
Syntax
number pi();
Attributes
Return type
Exception
Example
pi() returns 3.14159265358979323846;
Returns “base” risen to “exp”-power.
Syntax
number pow(numeric base, numeric exp);
Attributes
Return type
Exception
Example
pow(10, 2) returns 100;
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. The general contract is that one double value, chosen (approximately) uniformly from the range 0.0d (inclusive) to 1.0d (exclusive), is pseudorandomly generated and returned. All 2^53 possible float values of the form m x 2^-53, where m is a positive integer less than 2^53, are produced with (approximately) equal probability. The method is implemented by class Random.
Syntax
number random();
number random(long randomSeed);
Attributes
Return type
Exception
Example
print_err('Random number: '+random()) prints out: Random number: 0.2288097749720398 ;
(since 2.7)
Returns the pseudorandom, uniformly distributed boolean value from this random number generator's sequence. The general contract is that one boolean value is pseudorandomly generated and returned. The values true and false are produced with (approximately) equal probability. The method is implemented by class Random.
Syntax
boolean random_boolean();
boolean random_boolean(long randomSeed);
Attributes
Return type
Exception
Example
print_err('Random boolean: '+random_boolean()) prints out: Random boolean: true ;
(since 2.7)
Returns a double value with gaussian distribution. The general contract is that one double value, chosen from (approximately) the usual normal distribution with mean 0.0 and standard deviation 1.0, is pseudorandomly generated and returned. The method is implemented by class Random.
Syntax
number random_gaussian();
number random_gaussian(long randomSeed);
Attributes
Return type
Exception
Example
print_err('Random number: '+random_gaussian()) prints out: Random number: -1.051630836818732 ;
(since 2.7)
Returns an integer value. Returns the pseudorandom, uniformly distributed int value from this random number generator's sequence. The general contract is that one int value is pseudorandomly generated and returned. All 2^32 possible int values are produced with (approximately) equal probability. The method is implemented by class Random.
Syntax
int random_int();
int random_int(long randomSeed);
int random_int(int minValue, int maxValue);
int random_int(int minValue, int maxValue, long randomSeed);
Attributes
Return type
Exception
Example
print_err('Random integer: '+random_int()) prints out: Random integer: 456486773 ;
(since 2.7)
Returns a long value. Returns the pseudorandom, uniformly distributed long value from this random number generator's sequence. The general contract is that one long value is pseudorandomly generated and returned. All 2^64 possible long values are produced with (approximately) equal probability. The method is implemented by class Random.
Syntax
long random_long();
long random_long(long randomSeed);
long random_long(long minValue, long maxValue);
long random_long(long minValue, long maxValue, long randomSeed);
Attributes
Return type
Exception
Example
print_err('Random long: '+random_long()) prints out: Random long: 4564867735646 ;
Returns the closest long to the argument.
Syntax
Attributes
Return type
Exception
Example
round(10.45) returns 10 round(10.5) returns 11 round(10.55) returns 11
Returns square root of “arg” or NaN if “arg” is less then zero.
Syntax
Attributes
Return type
Exception
Example
sqrt(9) returns 3
Returns character of the input string at requested index.
Syntax
string char_at(string original, numeric index);
Attributes
Return type
Exception
Example
char_at(' text string ',1) returns 't'
(since 2.7)
Chops up the string from the new line separators or from given string.
Syntax
string chop(string arg);
string chop(string arg, string toChop);
Attributes
Return type
Example
chop("hello\\n") returns "hello"; chop("hello world",'world') returns "hello ";
Returns a string which is concatenation of function’s arguments. If argument is not of the string type, it is taken for concatenation its string representation. Usage of concat() function has the same result as addition, but works faster.
Syntax
string concat(type arg1, type arg2, …);
Attributes
Return type
Exception
Example
concat(arg1,arg2, .....);
Returns the number of occurrences of the “char” argument in “arg”, which is of the string type.
Syntax
int count_char(string arg, string char);
Attributes
Return type
Example
count_char('somestringasanexample','e') returns 3;
Returns the list of substrings that are get from the “arg” (which is of the string type) using the list of numbers specified as the second argument. The number of elements of this “listofnumbers” must be even. Each pair of adjacent numbers is used as a pair of position and length in a similar way as in the “substring(…)” function. Only the integer parts of numbers are used as position and length.
Syntax
list cut(string arg, list listofnumbers);
Attributes
Return type
Example
cut('somestringasanexample','[2,2,1,4]') returns ['me','omes'];
Calculates the edit distance between two strings: number of letters, that must be changed to get from one string to another.
since 2.7 vesion.
Syntax
int edit_distance(string str1, string str2, int strength, string locale, int maxDifference);
int edit_distance(string str1, string str2, int strength, int maxDifference);
int edit_distance(string str1, string str2, int strength, string locale);
int edit_distance(string str1, string str2, string locale, int maxDifference);
int edit_distance(string str1, string str2, int strength);
int edit_distance(string str1, string str2, string locale);
int edit_distance(string str1, string str2);
Attributes
Return type
Exception
Example
edit_distance('agata','agatą') returns 1 edit_distance('agata','agatą', 2, 'PL') returns 0
Returns the list of substrings corresponding to occurrences of the “regex” argument in “arg”, which is of the string type.
Syntax
list find(string arg, string regex);
Attributes
Return type
Example
find('somestringasanexample','[ea]') returns ['e','a','a','e','a','e'];
Removescharacters which are not letters nor digits from input string.
Syntax
string get_alphanumeric_chars(string original);
string get_alphanumeric_chars(string original, boolean takeAlpha, boolean takeNumeric);
Attributes
Return type
Exception
Example
get_alphanumeric_chars(' a\t1b\nc\rd \b e \f2f\r\n') returns 'a1bcde2f' get_alphanumeric_chars(' a\t1b\nc\rd \b e \f2f\r\n',true,false) returns 'abcdef' get_alphanumeric_chars(' a\t1b\nc\rd \b e \f2f\r\n',false,true) returns '12'
Returns the index within input string of the first occurrence of the specified substring, starting at the specified index, or -1 if the substring does not occur
Syntax
int index_of(string str, string search);
int index_of(string str, string search, int fromIndex);
Attributes
Return type
Exception
Example
index_of('hello world','l') returns 2 index_of('hello world','l',5) returns 9 index_of('hello world','hello',1) returns -1 index_of('hello world','world',1) returns 6
Tells whether or not the input string can be encoded by “US-ASCII” encoder.
Syntax
boolean is_ascii(string original);
Attributes
Return type
Exception
Example
is_ascii('test') returns 'true' is_ascii('aęř') returns 'false'
Checks if given string has characters others then space characters (SPACE_SEPARATOR, LINE_SEPARATOR, PARAGRAPH_SEPARATOR ).
Syntax
boolean is_blank(string original);
Attributes
Return type
Exception
Example
string test='test'; isBlank=is_blank(test) returns 'false' test=null; boolean isBlank2=is_blank(test) returns 'true'
Checks if the string can be parsed into a date with specified pattern (format).
Syntax
boolean is_date(string original,string format);
Attributes
Return type
Exception
Example
is_date('20Jul2000','ddMMMyyyy') returns 'true' is_date('4:42','HH:mm') returns 'true' is_date('20.11.2007','dd-MM-yyyy') returns 'false' is_date('test 20.11.2007','hhmm dd.MM.yyyy') returns 'false'
From ver. 2.4:
Checks if given string can be parsed to date due to given pattern and locale. With lenient argument set to true, convertor may use heuristics to interpret inputs that do not precisely match this object's format. With strict converting, inputs must match this object's format. First two arguments are necessary; when there are only three arguments, third argument is treated as locale if it is of type string (lenient is set to false by default) or as lenient if it is of type bool (locale is set to system value by default).
Checks if the string can be parsed into a date with specified pattern (format). Allows changing parser strictness (lenient):
Syntax
boolean is_date(string original,string format,bool lenient);
Attributes
Checks if the string can be parsed into a date with specified pattern (format) and locale:
Syntax
boolean is_date(string original,string format,string locale);
Attributes
Checks if the string can be parsed into a date with specified pattern (format) and locale. Allows changing parser strictness (lenient):
Syntax
boolean is_date(string original,string format,string locale,bool lenient);
Attributes
Example
is_date('20Jul2000','ddMMMyyyy','en.GB') returns 'true' iis_date('20Jul2000','ddMMMyyyy','pl.PL') returns 'false' is_date('20-15-2007','dd-MM-yyyy') returns 'true' is_date('20-15-2007','dd-MM-yyyy',false) returns 'false' is_date('20-15-2007','dd-MM-yyyy',true) returns 'true'
Checks if given string can be parsed as integer number with radix 10.
Syntax
boolean is_integer(string str);
Attributes
Return type
Exception
Example
is_integer('h3') returns false is_integer('78642325688990076654322234') returns false is_integer('786423') returns true
Checks if given string can be parsed as long number with radix 10.
Syntax
Attributes
Return type
Exception
Example
is_integer('h3') returns false is_integer('78642325688990076654322234') returns false is_integer('786423') returns true
Checks if given string can be parsed as double number with 10 radix.
Syntax
boolean is_number(string original);
Attributes
Return type
Exception
Example
is_number('1g')) returns 'false' is_number('8982.8992e-2') returns 'true'
Joins parameters to one string delimited by first argument. When there is list or map variable among parameters, each element of this variable is delimited by delimiter.
Syntax
string join(string delimiter,any parameter, …);
Attributes
Return type
Exception
Example
list seznam = [16, 17, 18, 19] map mapa = {f2=hello, f1=99} list novy=[{f2=hello, f1=99}, {f2=xxx, f1=10}, {f2=hello, f1=99}] join(':del:',seznam,mapa,novy[1]) returns '16:del:17:del:18:del:19:del:f2=hello:del:f1=99:del:f2=xxx:del:f1=10:del:'
Returns length first characters from original string.
Syntax
string left(string original,numeric length);
Attributes
Return type
Exception
Example
left('text', 2) returns 'te'
Returns the length of “arg” string or number of elements in list or map containers.
Syntax
Attributes
Return type
Exception
Example
length('value') returns 5;
Returns lower case representation of original string.
Syntax
string lowercase(string original);
Attributes
Return type
Exception
Example
lowercase('Value') returns 'value';
Finds the metaphone value of a String (see A Better Phonetic Lookup for more info).
since 2.7 version
Syntax
string metaphone(string original, int maxLength);
Attributes
Return type
Exception
Example
metaphone('CHRISSIE') returns XRS metaphone("Gwendoline", 10) returns KWNTLN metaphone("Gwendoline") returns KWNT
Finds The New York State Identification and Intelligence System Phonetic Code (see New York State Identification and Intelligence System for more info).
since 2.7 version
Syntax
string NYSIIS(string original);
Attributes
Return type
Exception
Example
NYSIIS("Cope") retuns 'CAP' NYSIIS("Kipp") returns 'CAP'
(since 2.7)
Returns strings generated at random, consisting of lowercase letters (a-z). The length of each string can even be equal to that specified by the arguments. However, the strings cannot be shorter or longer.
Syntax
string random_string(int minimum length of string,int maximum length of string);
string random_string(int minimum length of string,int maximum length of string, long randomSeed);
Attributes
Return type
Exception
Example
random_string(3, 5) can return 'dfg' for one record field, 'rtps' for another, etc. It can also return 'peqoh', however it can neither return 'zh' nor 'eldoft'.
Removes blank spaces from a string.
Syntax
string remove_blank_space(string original);
Attributes
Return type
Exception
Example
remove_blank_space(' a\tb\nc\rd e \ff\r\n') returns 'abcdef'
Replaces diacritic chars by theirs equivalence without diacritical marks. It works only for chars for which decomposition is defined.
Syntax
string remove_diacritic(string);
Attributes
Return type
Exception
Example
remove_diacritic('teścik') returns 'tescik'
Removes non-ascii characters from a string.
Syntax
string remove_nonascii(string original);
Attributes
Return type
Exception
Example
remove_nonascii('teścik') returns 'tecik'
Removes non-printable characters from a string.
Syntax
string remove_nonascii(string original);
Attributes
Return type
Exception
Example
remove_nonprintable('kula?ou?k?jabl??ko') returns 'kulaoukjablko'
returns string which has all occurrences of “regex” pattern changed to “replacement”.
Syntax
string replace(string original, string regex, string replacement);
Attributes
Return type
Exception
Example
replace('HELlo','[lL]','t') returns 'Hetto' – changed every 'l' or 'L' to 't'
Returns length last characters from original string.
Syntax
string right(string original,numeric length);
Attributes
Return type
Exception
Example
right('text', 2) returns 'xt'
Returns a string code for an input string consists of a letter followed by three numbers: the letter is the first letter of the argument, and the numbers encode the remaining consonants. Similar sounding consonants share the same number.
Syntax
Attributes
Return type
Exception
Example
soundex('word'); returns W600
Splits this string around matches of the given regular expression.
Syntax
list split(string original, string regex);
Attributes
Return type
Exception
Example
split('somestring','[st]') returns [,ome,,ring]
Returns sub-string of the original string starting from “from” letter and of length of “length”. When “from” or “length” are of number or decimal type it is taken integer part of argument.
Syntax
string substring(string original, numeric from, numeric length);
Attributes
Return type
Exception
Example
substring('text', 1, 2) returns 'ex'
Translates single characters in a string to different characters: replaces single characters at a time, translating the nth character in the match set with the nth character in the replacement set
Syntax
string translate(string original,string searchingSet, string replaceSet);
Attributes
Return type
Exception
Example
translate('hello','leo','pii') returns 'hippi'
Returns a copy of the string, with leading and trailing white spaces omitted.
Syntax
Attributes
Return type
Exception
Example
trim(' text string ') returns 'text string'
Returns upper case representation of original string.
Syntax
string uppercase(string original);
Attributes
Return type
Exception
Example
uppercase('Text') returns 'TEXT'
Adds the list specified as the second argument to the end of the list specified as the first argument and returns the resulting list.
Syntax
list copy(list arg1, list arg2);
Attributes
Return type
Example
list la; list lb; la=[2,4,3]; lb=[1,5]; copy(la,lb) returns [2,4,3,1,5]
Takes the elements contained as the arguments starting from the third argument and inserts them to the list specified as the first argument. The new elements are inserted to the list starting from the position specified as the second argument.
Syntax
boolean insert(list arg, numeric position, type newelement1, …, type newelementN);
Attributes
Return type
Example
list la; la=[3.5,4.1,1.7]; insert(la,2,6.4, 3.2) returns a boolean value. la is [3.5,4.1,6.4,3.2,1.7] now.
Removes the first element from the list and returns it.
Syntax
Attributes
Return type
Example
list la; la=[2,8,16]; poll(la) returns 2;
Removes the last element from the list and returns it.
Syntax
Attributes
Return type
Example
list la; la=[2,8,16]; pop(la) returns 16;
Adds a new element to the end of the list and returns the resulting list.
Syntax
boolean push(list arg, type newelement);
Attributes
Return type
Example
list la; la=[2,4,5]; push(la,1) returns a boolean value. la is [2,4,5,1] now.
Removes the element of the list at the specified position and returns the resulting list.
Syntax
list remove(list arg, numeric position);
Attributes
Return type
Example
list la; la=[3,16,27,5]; remove(la,2) returns [3,16,5];
Reverses the order of the elements of the list and returns the resulting list.
Syntax
Attributes
Return type
Example
list la; la=[3,5,2,16,4,1,9]; reverse(la) returns [9,1,4,16,2,5,3]
Sorts the elements of the list in ascending order and returns the resulting list.
Syntax
Attributes
Return type
Example
list la; la=[3,5,2,16,4,1,9]; sort(la) returns [1,2,3,4,5,9,16]
Returns truncation of “arg” - in case of list or map parameter, the effect is emptying the list or map passed in and the return value is null.
Syntax
trunc(list arg);
trunc(map arg);
Attributes
Returns string representation of dictionary object under specified name/key.
Syntax
string dict_get_str(string key);
Attributes
Return type
Exception
Example
dict_get_str('my_key') - returns value stored in dictionary under the key 'my_key'
Stores value passed as 2nd parameter under key (1st parameter) into graph dictionary.
Syntax
boolean dict_put_str(string key, string value);
Attributes
Return type
Exception
Example
dict_put_str('my_key','my_value'); - puts into dictionary value 'my_value' associated with key 'my_key'
Prints out global and local variables.
Syntax
void breakpoint();
Attributes
Return type
Exception
Example
breakpoint();
Returns “true_val” if “con” is true or “false_val” in other case.
Syntax
type iif(boolean con, type true_val, type false_val);
Attributes
Return type
Exception
Example
iif(true, 'val1', 'val2') returns 'val1' iif(false, 'val1', 'val2') returns 'val2'
Returns true if and only if “arg” value is null.
Syntax
Attributes
Return type
Exception
Example
string s; isnull(s) returns true; s = 'value'; isnull(s) returns false;
Returns value of “arg” if it is not null or “default” value if “arg” value is null.
Syntax
type nvl(type arg, type default);
Attributes
Return type
Exception
Example
string s; nvl(s, 'value') returns 'value' nvl('dest', 'value') returns 'dest'
Returns value of “true_value” if “arg” value is not null, or “false_value” value if “arg” value is null.
Syntax
type nvl2(type arg, type true_value, type false_value);
Attributes
Return type
Exception
Example
nvl2('something', 'is not null', 'is null') returns 'is not null' nvl2(null, 'is not null', 'is null') returns 'is null'
Prints out on error output “message” with location of error message.
Syntax
void print_err(type message);
void print_err(type message, boolean printLocation);
Attributes
Return type
Exception
Example
print_err('some error message text');
Sends message to logger. Remember that log levels must be specified as constants in the function! They can neither be received as field values nor be defined as variables.
Syntax
void print_log(enum level, type message);
Attributes
Return type
Exception
Example
print_log(fatal,'some error message text');
Prints out all variables from stack.
Syntax
void print_stack();
Attributes
Return type
Exception
Example
print_stack();
Throws out error.
Syntax
void raise_error(string message);
Attributes
Return type
Exception
Example
raise_error(\"my testing error\"); throws org.jetel.interpreter.TransformLangExecutorRuntimeException: Interpreter runtime exception on line 1 column 13 : !!! Exception raised by user: my testing error