Some functions work with strings.
In the functions that work with strings, sometimes a format pattern of a date or any number must be defined.
For detailed information about date formatting and/or parsing see Data and Time Format.
For detailed information about formatting and/or parsing of any numeric data type see Numeric Format.
For detailed information about locale see Locale.
Note | |
---|---|
Remember that numeric and date formats are displayed using system
value Locale or Locale specified in the For more information on how Locale may be changed in the |
Here we provide the list of the functions:
string char_at(
string arg, <numeric type> index)
;
The char_at(string, <numeric type>)
function
accepts two arguments: the first is string and the other is of any
numeric data type. It takes the string and returns the character
that is located at the position specified by the
index
.
string chop(
string arg)
;
The chop(string)
function accepts one
string argument. The function takes this argument, removes the
line feed and the carriage return characters from the end of the
string specified as the argument and returns the new string
without these characters.
string chop(
string arg1, string arg2)
;
The chop(string, string)
function accepts
two string arguments. It takes the first argument, removes the
string specified as the second argument from the end of the first
argument and returns the first string argument without the string
specified as the second argument.
string concat(
<any type> arg1, ... ..., <any type> argN)
;
The concat(<any type>, ..., <any type>)
function accepts unlimited number of arguments of any data type.
But they do not need to be the same. It takes these arguments and
returns their concatenation. If some arguments are not strings,
they are converted to their string representation before the
concatenation is done. You can also concatenate these arguments
using plus signs, but this function is faster for more than two
arguments.
int count_char(
string arg, string character)
;
The count_char(string, string)
function
accepts two arguments: the first is string and the second is one
character. It takes them and returns the number of occurrence of
the character specified as the second argument in the string
specified as the first argument.
list cut(
string arg, list list)
;
The cut(string, list)
function accepts
two arguments: the first is string and the second is list of
numbers. The function returns a list of strings. The number of
elements of the list specified as the second argument must be
even. The integer part of each pair of such adjacent numbers of
the list argument serve as position (each number in the odd
position) and length (each number in the even position).
Substrings of the specified length are taken from the string
specified as the first argument starting from the specified
position (excluding the character at the specified position). The
resulting substrings are returned as list of strings. For example,
cut("somestringasanexample",[2,3,1,5])
returns
["mes","omest"]
.
int edit_distance(
string arg1, string arg2)
;
The edit_distance(string, string)
function accepts two string arguments. These strings will be
compared to each other. The strength of comparison is 4 by
default, the default value of locale for comparison is the system
value and the maximum difference is 3 by default.
(For more details, see another version of the
edit_distance()
function below - the
edit_distance(string, string, int, string, int)
function.)
The function returns the number of letters that should be
changed to transform one of the two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
int edit_distance(
string arg1, string arg2, string locale)
;
The edit_distance(string, string, string)
function accepts three arguments. The first two are strings that
will be compared to each other and the third (string) is the
locale that will be used for comparison. The default strength of
comparison is 4. The maximum difference is 3 by default.
(For more details, see another version of the
edit_distance()
function below - the
edit_distance(string, string, int, string, int)
function.)
The function returns the number of letters that should be
changed to transform one of the first two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
See http://java.sun.com/j2se/1.6.0/docs/api/java/util/Locale.html for details about Locale.
int edit_distance(
string arg1, string arg2, int strength)
;
The edit_distance(string, string, int)
function accepts three arguments. The first two are strings that
will be compared to each other and the third (integer) is the
strength of comparison. The default locale that will be used for
comparison is the system value. The maximum difference is 3 by
default.
(For more details, see another version of the
edit_distance()
function below - the
edit_distance(string, string, int, string, int)
function.)
The function returns the number of letters that should be
changed to transform one of the first two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
int edit_distance(
string arg1, string arg2, int strength, string locale)
;
The edit_distance(string, string, int,
string)
function accepts four arguments. The first two
are strings that will be compared to each other, the third
(integer) is the strength of comparison and the fourth (string) is
the locale that will be used for comparison. The maximum
difference is 3 by default.
(For more details, see another version of the
edit_distance()
function below - the
edit_distance(string, string, int, string, int)
function.)
The function returns the number of letters that should be
changed to transform one of the first two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
See http://java.sun.com/j2se/1.6.0/docs/api/java/util/Locale.html for details about Locale.
int edit_distance(
string arg1, string arg2, string locale, int maxDifference)
;
The edit_distance(string, string, string,
int)
function accepts four arguments. The first two are
strings that will be compared to each other, the third (string) is
the locale that will be used for comparison and the fourth
(integer) is the maximum difference. The strength of comparison is
4 by default.
(For more details, see another version of the
edit_distance()
function below - the
edit_distance(string, string, int, string, int)
function.)
The function returns the number of letters that should be
changed to transform one of the first two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
See http://java.sun.com/j2se/1.6.0/docs/api/java/util/Locale.html for details about Locale.
int edit_distance(
string arg1, string arg2, int strength, int maxDifference)
;
The edit_distance(string, string, int,
int)
function accepts four arguments. The first two are
strings that will be compared to each other and the two others are
both integers. These are the strength of comparison (third
argument) and the maximum difference (fourth argument). The locale
is the default system value.
(For more details, see another version of the
edit_distance()
function below - the
edit_distance(string, string, int, string, int)
function.)
The function returns the number of letters that should be
changed to transform one of the first two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
int edit_distance(
string arg1, string arg2, int strength, string locale, int maxDifference)
;
The edit_distance(string, string, int, string,
int)
function accepts five arguments. The first two are
strings, the three others are integer, string and integer,
respectively. The function takes the first two arguments and
compares them to each other using the other three
arguments.
The third argument (integer number) specifies the strength of comparison. It can have any value from 1 to 4.
If it is 4 (identical comparison), that means that only
identical letters are considered equal. In case of 3 (tertiary
comparison), that means that upper and lower cases are considered
equal. If it is 2 (secondary comparison), that means that letters
with diacritical marks are considered equal. And, if the strength
of comparison is 1 (primary comparison), that means that even the
letters with some specific signs are considered equal. In other
versions of the edit_distance()
function where
this strength of comparison is not specified, the number 4 is used
as the default strength (see above).
The fourth argument is of string data type. It is the locale
that serves for comparison. If no locale is specified in other
versions of the edit_distance()
function, its
default value is the system value (see above).
The fifth argument (integer number) means the number of
letters that should be changed to transform one of the first two
arguments to the other. If other version of the
edit_distance()
function does not specify this
maximum difference, as the default maximum difference is accepted
the number 3 (see above).
The function returns the number of letters that should be
changed to transform one of the first two arguments to the other.
However, when the function is being executed, if it counts that
the number of letters that should be changed is at least the
number specified as the maximum difference, the execution
terminates and the function returns maxDifference +
1
as the return value.
Actually the function is implemented for the following locales: CA, CZ, ES, DA, DE, ET, FI, FR, HR, HU, IS, IT, LT, LV, NL, NO, PL, PT, RO, SK, SL, SQ, SV, TR.
See http://java.sun.com/j2se/1.6.0/docs/api/java/util/Locale.html for details about Locale.
list find(
string arg, string regex)
;
The find(string, string)
function accepts
two string arguments. The second one is regular expression. The
function takes them and returns a list of substrings corresponding
to the regex pattern that are found in the string specified as the
first argument.
string
get_alphanumeric_chars(
string arg)
;
The get_alphanumeric_chars(string)
function takes one string argument and returns only letters and
digits contained in the string argument in the order of their
appearance in the string. The other characters are removed.
string
get_alphanumeric_chars(
string arg, boolean takeAlpha, boolean
takeNumeric)
;
The get_alphanumeric_chars(string, boolean,
boolean)
function accepts three arguments: one string
and two booleans. It takes them and returns letters and/or digits
if the second and/or the third arguments, respectively, are set to
true.
int index_of(
string arg, string substring)
;
The index_of(string, string)
function
accepts two strings. It takes them and returns the index of the
first appearance of substring
in the string
specified as the first argument.
int index_of(
string arg, string substring, int fromIndex)
;
The index_of(string, string, int)
function accepts three arguments: two strings and one integer. It
takes them and returns the index of the first appearance of
substring
counted from the character located at
the position specified by the third argument.
boolean is_ascii(
string arg)
;
The is_ascii(string)
function takes one
string argument and returns a boolean value depending on whether
the string can be encoded as an ASCII string (true) or not
(false).
boolean is_blank(
string arg)
;
The is_blank(string)
function takes one
string argument and returns a boolean value depending on whether
the string contains only white space characters (true) or not
(false).
boolean is_date(
string arg, string pattern)
;
The is_date(string, string)
function
accepts two string arguments. It takes them, compares the first
argument with the second as a pattern and, if the first string can
be converted to a date which is valid within system value of
locale
, according to the specified
pattern
, the function returns true. If it is
not possible, it returns false.
(For more details, see another version of the
is_date()
function below - the
is_date(string, string, string, boolean)
function.)
This function is a variant of the mentioned
is_date(string, string, string, boolean)
function in which the default value of the third argument is set
to system value and the fourth argument is set to false by
default.
boolean is_date(
string arg, string pattern, string locale)
;
The is_date(string, string, string)
function accepts three string arguments. It takes them, compares
the first argument with the second as a pattern, use the third
argument (locale
) and, if the first string can
be converted to a date which is valid within specified
locale
, according to the specified
pattern
, the function returns true. If it is
not possible, it returns false.
(For more details, see another version of the
is_date()
function below - the
is_date(string, string, string, boolean)
function.)
This function is a variant of the mentioned
is_date(string, string, string, boolean)
function in which the default value of the fourth argument
(lenient
) is set to false by default.
See http://java.sun.com/j2se/1.6.0/docs/api/java/util/Locale.html for details about Locale.
boolean is_date(
string arg, string pattern, boolean lenient)
;
The is_date(string, string, boolean)
function accepts two string arguments and one boolean.
Note | |
---|---|
Since the version 2.8.1 of
CloudConnect, the
|
The function takes these arguments, compares the first
argument with the second as a pattern and, if the first string can
be converted to a date which is valid within system value of
locale
, according to the specified
pattern
, the function returns true. If it is
not possible, it returns false.
(For more details, see another version of the
is_date()
function below - the
is_date(string, string, string, boolean)
function.)
This function is a variant of the mentioned
is_date(string, string, string, boolean)
function in which the default value of the third argument
(locale
) is set to system value.
boolean is_date(
string arg, string pattern, string locale, boolean lenient)
;
The is_date(string, string, string,
boolean)
function accepts three string arguments and one
boolean.
Note | |
---|---|
Since the version 2.8.1 of
CloudConnect, the
|
The function takes these arguments, compares the first
argument with the second as a pattern, use the third
(locale
) argument and, if the first string can
be converted to a date which is valid within specified
locale
, according to the specified
pattern
, the function returns true. If it is
not possible, it returns false.
See http://java.sun.com/j2se/1.6.0/docs/api/java/util/Locale.html for details about Locale.
boolean is_integer(
string arg)
;
The is_integer(string)
function takes one
string argument and returns a boolean value depending on whether
the string can be converted to an integer number (true) or not
(false).
boolean is_long(
string arg)
;
The is_long(string)
function takes one
string argument and returns a boolean value depending on whether
the string can be converted to a long number (true) or not
(false).
boolean is_number(
string arg)
;
The is_number(string)
function takes one
string argument and returns a boolean value depending on whether
the string can be converted to a double (true) or not
(false).
string join(
string delimiter, <any type> arg1, ... ..., <any type> argN)
;
The join(string, <any type>, ..., <any type>)
function accepts unlimited number of arguments. The first is
string, the others are of any data type. All data types do not
need to be the same. The arguments that are not strings are
converted to their string representation and put together with the
first argument as delimiter.
Note | |
---|---|
This function was already included in
CloudConnect Engine and
CloudConnect Designer that were release
before 2.7.0 or 2.2.0, respectively. However, this older version
of the In older releases Thus, if you want to run an old graph created for old
version of CloudConnect Engine and
CloudConnect Designer that uses this
function in CloudConnect Engine 2.7.0
and CloudConnect Designer 2.2.0 or
higher, replace the old |
string join(
string delimiter, arraytype arg)
;
The join(string, arraytype)
function
accepts two arguments. The first is string, the other one is an
array. The elements of the array argument are converted to their
string representation and put together with the first argument as
delimiter between each pair of them.
Note | |
---|---|
Also in this case, older versions of CloudConnect Engine and CloudConnect Designer added a delimiter to the end of the resulting sequence, whereas the new versions (since CloudConnect Engine 2.7.0 and CloudConnect Designer 2.2.0) do not add any delimiter to its end. |
string left(
string arg, <numeric type> length)
;
The left(string, <numeric type>)
function
accepts two arguments: the first is string and the other is of any
numeric data type. It takes them and returns the substring of the
length specified as the second argument counted from the start of
the string specified as the first argument.
int length(
structuredtype arg)
;
The length(structuredtype)
function
accepts one argument of structured data type:
string
, bytearray
,
list
, map
or
record
. It takes this argument and returns the
number of elements composing the argument.
string lowercase(
string arg)
;
The lowercase(string)
function takes one
string argument and returns another string with cases converted to
lower cases only.
string metaphone(
string arg, int maxLength)
;
The metaphone(string, int)
function
accepts one string argument and one integer meaning the maximum
length. The function takes these arguments and returns the
metaphone code of the first argument of the specified maximum
length. The default maximum length is 4. For more information, see
the following site: www.lanw.com/java/phonetic/default.htm.
string NYSIIS(
string arg)
;
The NYSIIS(string)
function takes one
string argument and returns the New York State Identification and
Intelligence System Phonetic Code of the argument. For more
information, see the following site: http://en.wikipedia.org/wiki/New_York_State_Identification_and_Intelligence_System.
string random_string(
int minLength, int maxLength)
;
The random_string(int, int)
function
takes two integer arguments and returns strings composed of
lowercase letters whose length varies between
minLength
and maxLength
.
These resulting strings are generated at random for records and
fields. They can be different for both different records and
different fields. Their length can also be equal to
minLength
or maxLength
,
however, they can be neither shorter than
minLength
nor longer than
maxLength
.
string random_string(
int minLength, int maxLength, long randomSeed)
;
The random_string(int, int, long)
function takes two integer arguments and one long argument and
returns strings composed of lowercase letters whose length varies
between minLength
and
maxLength
. These resulting strings are
generated at random for records and fields. They can be different
for both different records and different fields. Their length can
also be equal to minLength
or
maxLength
, however, they can be neither shorter
than minLength
nor longer than
maxLength
. The argument ensures that the
generated values remain the same upon each run of the
graph.
string
remove_blank_space(
string arg)
;
The remove_blank_space(string)
function
takes one string argument and returns another string with white
spaces removed.
string
remove_diacritic(
string arg)
;
The remove_diacritic(string)
function
takes one string argument and returns another string with
diacritical marks removed.
string remove_nonascii(
string arg)
;
The remove_non ascii(string)
function
takes one string argument and returns another string with
non-ascii characters removed.
string
remove_nonprintable(
string arg)
;
The remove_nonprintable(string)
function
takes one string argument and returns another string with
non-printable characters removed.
string replace(
string arg, string regex, string replacement)
;
The replace(string, string, string)
function takes three string arguments - a string, a
regular expression,
and a replacement - and replaces all regex matches inside the string
with the replacement string you specified. All parts of the string
that match the regex are replaced. You can also reference the matched
text using a backreference in the replacement string. A backreference
to the entire match is indicated as $0. If there are capturing parentheses,
you can reference specifics groups as $1, $2, $3, etc.
replace("Hello","[Ll]","t")
returns
"Hetto"
replace("Hello","[Ll]",$0)
returns "HeHelloHelloo"
string right(
string arg, <numeric type> length)
;
The right(string, <numeric type>)
function
accepts two arguments: the first is string and the other is of any
numeric data type. It takes them and returns the substring of the
length specified as the second argument counted from the end of
the string specified as the first argument.
string soundex(
string arg)
;
The soundex(string)
function takes one
string argument and converts the string to another. The resulting
string consists of the first letter of the string specified as the
argument and three digits. The three digits are based on the
consonants contained in the string when similar numbers correspond
to similarly sounding consonants. Thus,
soundex("word")
returns
"w600"
.
list split(
string arg, string regex)
;
The split(string, string)
function
accepts two string arguments. The second is some regular
expression. It is searched in the first string argument and if it
is found, the string is split into the parts located between the
characters or substrings of such a regular expression. The
resulting parts of the string are returned as a list. Thus,
split("abcdefg", "[ce]")
returns
.["ab"
, "d"
,
"fg"
]
string substring(
string arg, <numeric type>
fromIndex, <numeric type> length)
;
The substring(string, <numeric type>,
<numeric type>)
function accepts three arguments: the first
is string and the other two are of any numeric data type. The two
numeric types do not need to be the same. The function takes the
arguments and returns a substring of the defined length obtained
from the original string by getting the length
number of characters starting from the position defined by the
second argument. If the second and third arguments are not
integers, only the integer parts of them are used by the function.
Thus, substring("text", 1.3, 2.6)
returns
"ex"
.
string translate(
string arg, string
searchingSet, string replaceSet)
;
The translate(string, string, string)
function accepts three string arguments. The number of characters
must be equal in both the second and the third arguments. If some
character from the string specified as the second argument is
found in the string specified as the first argument, it is
replaced by a character taken from the string specified as the
third argument. The character from the third string must be at the
same position as the character in the second string. Thus,
translate("hello", "leo", "pii")
returns
"hippi"
.
string trim(
string arg)
;
The trim(string)
function takes one
string argument and returns another string with leading and
trailing whitespace characters removed.
string uppercase(
string arg)
;
The uppercase(string)
function takes one
string argument and returns another string with cases converted to
upper cases only.