Embedded functions
Functions are called in calculated expressions. Every supported signature is listed for each function: argument types and the result type. Methods that are called on a value (for example, on an array or a dictionary) are described in Methods.
Type conversion
|
Function |
Description |
|
|
Converts argument value to boolean type. Returns true if argument is 1, false if argument is 0, error if argument is other. Argument: |
|
|
Converts argument value to boolean type. Returns true if argument is "true", false if argument is "false", error if argument is other. Argument: |
|
|
Converts argument value to integer type. Returns 1 if argument is true, 0 if argument is false. Argument: |
|
|
Converts argument value to integer type. Rounds number value down. Returns integer value. Argument: |
|
|
Converts argument value to integer type. Returns integer value. Argument: |
|
|
Converts argument value to number type. Returns number value. Argument: |
|
|
Converts argument value to number type. Returns number value. Argument: |
|
|
Converts argument value to color type. Returns color value. Argument: |
|
|
Converts argument value to url type. Returns url value. Argument: |
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the value of a variable by its name. If the variable doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the default value would be returned. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the exception will be thrown. Argument: |
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the exception will be thrown. Arguments:
|
|
|
Returns the stored value by its name. If the value doesn't exist or has incorrect type, the exception will be thrown. Argument: |
|
|
Returns the stored value by its name. If the value doesn't exist in specified scope or has incorrect type, the exception will be thrown. Arguments:
|
Conversion to string
|
Function |
Description |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
|
|
Returns a string representation of given value. Argument: |
Mathematical operations
|
Function |
Description |
|
|
Calculates division between the first number and the second. Returns integer quotient of division. Arguments:
|
|
|
Calculates division between the first number and the second. Returns number quotient of division. Arguments:
|
|
|
Calculates remainder of division the first number and the second. Returns integer remainder of division. Arguments:
|
|
|
Calculates remainder of division the first number and the second. Returns number remainder of division. Arguments:
|
|
|
Calculates multiplication between argument values. Returns integer result of multiplication. Argument: |
|
|
Calculates multiplication between argument values. Returns number result of multiplication. Argument: |
|
|
Calculates subtraction between argument values. Returns integer result of subtraction. Argument: |
|
|
Calculates subtraction between argument values. Returns number result of subtraction. Argument: |
|
|
Calculates sum between argument values. Returns integer result of sum. Argument: |
|
|
Calculates sum between argument values. Returns number result of sum. Argument: |
|
|
Gets max value of integer type. Returns max integer value. No arguments. |
|
|
Gets max value of number type. Returns max number value. No arguments. |
|
|
Gets min value of integer type. Returns min integer value. No arguments. |
|
|
Gets min value of number type. Returns min number value. No arguments. |
|
|
Gets max value of argument values. Returns max integer value. Argument: |
|
|
Gets max value of argument values. Returns max number value. Argument: |
|
|
Gets min value of argument values. Returns min integer value. Argument: |
|
|
Gets min value of argument values. Returns min number value. Argument: |
|
|
Gets absolute value of argument. Returns integer value. Argument: |
|
|
Gets absolute value of argument. Returns number value. Argument: |
|
|
Gets sign value from argument. Returns -1 if value is negative, 0 if value is equal to 0, 1 if value is positive. Argument: |
|
|
Gets sign value from argument. Returns -1.0 if value is negative, 0.0 if value is equal to 0, 1.0 if value is positive. Argument: |
|
|
Rounds argument value to the closest integer value. 1.49 -> 1.0, 1.5 -> 2.0. Returns number value. Argument: |
|
|
Rounds argument value down. 1.49 -> 1.0, 1.5 -> 1.0. Returns number value. Argument: |
|
|
Rounds argument value up. 1.49 -> 2.0, 1.5 -> 2.0. Returns number value. Argument: |
|
|
Gets value of first argument with sign of the second argument. Returns integer value. Arguments:
|
|
|
Gets value of first argument with sign of the second argument. Returns number value. Arguments:
|
Trigonometric functions
|
Function |
Description |
|
|
Returns value of the No arguments. |
|
|
Converts the argument value from degrees to radians Argument: |
|
|
Converts the argument value from radians to degrees Argument: |
|
|
Calculates the sine of the given angle in radians Argument: |
|
|
Calculates the cosine of the given angle in radians Argument: |
|
|
Calculates the tangent of the given angle in radians Argument: |
|
|
Calculates the angle in radians of the given sine value Argument: |
|
|
Calculates the angle in radians of the given cosine value Argument: |
|
|
Calculates the angle in radians for a given tangent value Argument: |
|
|
Calculates the angle in radians for given values (y,x) Arguments:
Available platforms: Android, web. |
|
|
Calculates the cotangent of the given angle in radians Argument: |
String operations
|
Function |
Description |
|
|
Gets the length of string argument. Returns integer value. Argument: |
|
|
Gets if second string argument contains in first string argument. Returns boolean value. Arguments:
|
|
|
Gets substring of first argument in range of last arguments. Returns string value. Arguments:
|
|
|
Replaces all occurrences of the second argument in the first argument with the third argument. Returns string value of replaced string. Arguments:
|
|
|
Gets first index of second argument in first argument. Returns integer value, index of occurrence or -1 if substring is not found. Arguments:
|
|
|
Gets last index of second argument in first argument. Returns integer value, index of occurrence or -1 if substring is not found. Arguments:
|
|
|
Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme. Returns string value, encoded string. Argument: |
|
|
Decodes a application/x-www-form-urlencoded string using a specific encoding scheme. Returns string value, decoded string. Argument: |
|
|
Returns a string having leading and trailing whitespace removed. Argument: |
|
|
Returns a string having leading whitespace removed. Argument: |
|
|
Returns a string having trailing whitespace removed. Argument: |
|
|
Returns converted to upper case string. Argument: |
|
|
Returns converted to lower case string. Argument: |
|
|
Pads a string to a given string length, inserting at start Arguments:
|
|
|
Converts given integer to a string and pads it to a given string length, inserting at start Arguments:
|
|
|
Pads a string to a given string length, inserting at end Arguments:
|
|
|
Converts given integer to a string and pads it to a given string length, inserting at end Arguments:
|
|
|
Checks whether the string matches the regular expression. Arguments:
|
|
|
Encodes a string for safe use in regular expressions. Argument: Available platforms: Android, web. |
Color operations
|
Function |
Description |
|
|
Gets alpha value of argument color. Returns number value in range 0.0 to 1.0 of alpha value of color. Argument: |
|
|
Gets alpha value of argument color. Returns number value in range 0.0 to 1.0 of alpha value of color. Argument: |
|
|
Gets red value of argument color. Returns number value in range 0.0 to 1.0 of red value of color. Argument: |
|
|
Gets red value of argument color. Returns number value in range 0.0 to 1.0 of red value of color. Argument: |
|
|
Gets green value of argument color. Returns number value in range 0.0 to 1.0 of green value of color. Argument: |
|
|
Gets green value of argument color. Returns number value in range 0.0 to 1.0 of green value of color. Argument: |
|
|
Gets blue value of argument color. Returns number value in range 0.0 to 1.0 of blue value of color. Argument: |
|
|
Gets blue value of argument color. Returns number value in range 0.0 to 1.0 of blue value of color. Argument: |
|
|
Sets alpha value of argument color. Returns string value of color in hex format '#FFAABBCC'. Arguments:
|
|
|
Sets alpha value of argument color. Returns color. Arguments:
|
|
|
Sets red value of argument color. Returns string value of color in hex format '#FFAABBCC'. Arguments:
|
|
|
Sets red value of argument color. Returns color. Arguments:
|
|
|
Sets green value of argument color. Returns string value of color in hex format '#FFAABBCC'. Arguments:
|
|
|
Sets green value of argument color. Returns Color. Arguments:
|
|
|
Sets blue value of argument color. Returns string value of color in hex format '#FFAABBCC'. Arguments:
|
|
|
Sets blue value of argument color. Returns Color. Arguments:
|
|
|
Creates color from values of alpha, red, green, blue values. Returns string value of color in hex format '#FFAABBCC'. Arguments:
|
|
|
Blends two colors by alpha channel. Returns color. Arguments:
|
|
|
Creates color from values of red, green, blue values. Sets alpha value as 1.0. Returns color value of color in hex format '#FFAABBCC'. Arguments:
|
Date and time operations
|
Function |
Description |
|
|
Creates datetime from integer value of unix time. Returns datetime value. Argument: |
|
|
Creates datetime in local timezone from integer value of unix time. Returns datetime value. Argument: |
|
|
Creates datetime from time of now. Returns datetime value. No arguments. |
|
|
Adds milliseconds to original date. Returns datetime with added time in milliseconds. Arguments:
|
|
|
Sets year number to original date. Returns datetime with year set. Arguments:
|
|
|
Sets month number to original date. Returns datetime with month set. Arguments:
|
|
|
Sets day of month number to original date. Returns datetime with day of month set. Arguments:
|
|
|
Sets hours number to original date. Returns datetime with hours set. Arguments:
|
|
|
Sets minutes number to original date. Returns datetime with minutes set. Arguments:
|
|
|
Sets seconds number to original date. Returns datetime with seconds set. Arguments:
|
|
|
Sets milliseconds number to original date. Returns datetime with milliseconds set. Arguments:
|
|
|
Returns year number of original date. Argument: |
|
|
Returns month number of original date. Argument: |
|
|
Returns day of month of original date. Argument: |
|
|
Returns day of week of original date, where Sunday is 7. Argument: |
|
|
Returns hours number of original date. Argument: |
|
|
Returns minutes number of original date. Argument: |
|
|
Returns seconds number of original date. Argument: |
|
|
Returns milliseconds number of original date. Argument: |
|
|
Returns the datetime value as timestamp in milliseconds. Argument: |
|
|
Formatting dates in a local timezone in users locale. Used default locale. Look https://en.wikipedia.org/wiki/ISO_8601 for more. Arguments:
|
|
|
Formatting dates in a UTC timezone in users locale. Used default locale. Look https://en.wikipedia.org/wiki/ISO_8601 for more. Arguments:
|
|
|
Formatting dates in a local timezone with localization. Look https://en.wikipedia.org/wiki/ISO_8601 for more. Arguments:
|
|
|
Formatting dates in a UTC timezone with localization. Look https://en.wikipedia.org/wiki/ISO_8601 for more. Arguments:
|
Time interval operations
|
Function |
Description |
|
|
Gets the seconds component of the duration. Expressed as a value between 0 and 59. Argument: |
|
|
Gets the number of seconds in duration. Argument: |
|
|
Gets the minutes component of the duration. Expressed as a value between 0 and 59. Argument: |
|
|
Gets the number of minutes in duration. Argument: |
|
|
Gets the hours component of the duration. Expressed as a value between 0 and 23. Argument: |
|
|
Gets the number of hours in duration. Argument: |
|
|
Gets the number of days in duration. Argument: |
|
|
Gets the number of weeks in duration. Argument: |
Array operations
|
Function |
Description |
|
|
Returns a string value from array. Arguments:
|
|
|
Returns a number value from array. Arguments:
|
|
|
Returns an integer value from array. Arguments:
|
|
|
Returns a boolean property from array. Arguments:
|
|
|
Returns a color property from array. Arguments:
|
|
|
Returns an optional string property from array. Arguments:
|
|
|
Returns an optional number property from array. Arguments:
|
|
|
Returns an optional integer property from array. Arguments:
|
|
|
Returns an optional boolean value from array. Arguments:
|
|
|
Returns an optional color value from array. Arguments:
|
|
|
Returns an optional color value from array. Arguments:
|
|
|
Returns an url value from array. Arguments:
|
|
|
Returns an optional url value from array. Arguments:
|
|
|
Returns an optional url value from array. Arguments:
|
|
|
Returns a string value from array. Arguments:
|
|
|
Returns a number value from array. Arguments:
|
|
|
Returns an integer value from array. Arguments:
|
|
|
Returns a boolean property from array. Arguments:
|
|
|
Returns a color property from array. Arguments:
|
|
|
Returns an optional string property from array. Arguments:
|
|
|
Returns an optional number property from array. Arguments:
|
|
|
Returns an optional integer property from array. Arguments:
|
|
|
Returns an optional boolean value from array. Arguments:
|
|
|
Returns an optional color value from array. Arguments:
|
|
|
Returns an optional color value from array. Arguments:
|
|
|
Returns an url value from array. Arguments:
|
|
|
Returns an optional url value from array. Arguments:
|
|
|
Returns an optional url value from array. Arguments:
|
|
|
Returns an array value from array Arguments:
|
|
|
Returns an array value from array if exist or empty array otherwise Arguments:
|
|
|
Returns an dict value from array Arguments:
|
|
|
Returns an dict value from array if exist or empty dict otherwise Arguments:
|
|
|
Gets the length of array. Returns integer value. Argument: |
Dictionary operations
|
Function |
Description |
|
|
Returns a string value from dictionary. Arguments:
|
|
|
Returns a number value from dictionary. Arguments:
|
|
|
Returns an integer value from dictionary. Arguments:
|
|
|
Returns a boolean property from dictionary. Arguments:
|
|
|
Returns a color property from dictionary. Arguments:
|
|
|
Returns an url property from dictionary. Arguments:
|
|
|
Returns an optional string property from dictionary. Arguments:
|
|
|
Returns an optional number property from dictionary. Arguments:
|
|
|
Returns an optional integer property from dictionary. Arguments:
|
|
|
Returns an optional boolean property from dictionary. Arguments:
|
|
|
Returns an optional color property from dictionary. Arguments:
|
|
|
Returns an optional color property from dictionary. Arguments:
|
|
|
Returns an optional url property from dictionary. Arguments:
|
|
|
Returns an optional url property from dictionary. Arguments:
|
|
|
Returns a string value from dictionary. Arguments:
|
|
|
Returns a number value from dictionary. Arguments:
|
|
|
Returns an integer value from dictionary. Arguments:
|
|
|
Returns a boolean property from dictionary. Arguments:
|
|
|
Returns a color property from dictionary. Arguments:
|
|
|
Returns an url property from dictionary. Arguments:
|
|
|
Returns an dict property from dictionary. Arguments:
|
|
|
Returns an array property from dictionary. Arguments:
|
|
|
Returns an optional string property from dictionary. Arguments:
|
|
|
Returns an optional number property from dictionary. Arguments:
|
|
|
Returns an optional integer property from dictionary. Arguments:
|
|
|
Returns an optional boolean property from dictionary. Arguments:
|
|
|
Returns an optional color property from dictionary. Arguments:
|
|
|
Returns an optional color property from dictionary. Arguments:
|
|
|
Returns an optional url property from dictionary. Arguments:
|
|
|
Returns an optional url property from dictionary. Arguments:
|
|
|
Returns an array value from dict if exist or empty array otherwise. Arguments:
|
|
|
Returns an dict value from dict if exist or empty dict otherwise. Arguments:
|
|
|
Counts the number of elements in a dictionary. Argument: |
|
|
Return a collection containing just the keys of the dictionary. Argument: |
|
|
Return a collection containing just the values of the dictionary. Argument: |
Number formatting
|
Function |
Description |
|
|
Returns a string value from an integer using format. Arguments:
|
|
|
Returns a string value from an number using format. Arguments:
|
|
|
Returns a string value from an integer using format and locale. Arguments:
|
|
|
Returns a string value from an number using format and locale. Arguments:
|
Learn more
You can discuss topics of interest in the DivKit user community in Telegram: https://t.me/divkit_community_en.