Embedded functions
Type conversion
Function |
Description |
|
Converts the argument to a boolean. Argument: |
|
Converts the argument to a boolean. Argument: |
|
Converts the argument to an integer. Argument: |
|
Converts the argument to an integer. Rounds down the result. Argument: |
|
Converts the argument to an integer. Argument: |
|
Converts the argument to a floating-point number. Argument: |
|
Converts the argument to a floating-point number. Argument: |
|
Converts the argument to a string. Argument: |
|
Converts the argument to a string. Argument: |
|
Converts the argument to a string. Argument: |
|
Encodes the string in Argument: |
|
Decodes the Argument: |
Mathematical operations
Mathematical operations
Function |
Description |
|
Calculates the quotient of the first number divided by the second. Rounds down the result. For example: Arguments: 1 — |
|
Calculates the quotient of the first number divided by the second. Arguments: 1 — |
|
Calculates the remainder of the first number divided by the second. Arguments: 1 — |
|
Calculates the product of the arguments. Arguments: multiple |
|
Calculates the product of the arguments. Arguments: Multiple |
|
Calculates the difference of the arguments. Arguments: 1 — |
|
Calculates the difference of the arguments. Arguments: 1 — |
|
Calculates the sum of the arguments. Arguments: multiple |
|
Calculates the sum of the arguments. Arguments: Multiple |
|
Calculates the absolute value of the argument. Argument: |
|
Calculates the absolute value of the argument. Argument: |
|
Finds the argument with the highest value. Arguments: Multiple |
|
Finds the argument with the highest value. Arguments: multiple |
|
Finds the argument with the lowest value. Arguments: multiple |
|
Finds the argument with the lowest value. Arguments: Multiple |
|
Finds the No arguments. |
|
Finds the No arguments. |
|
Finds the No arguments. |
|
Finds the No arguments. |
|
Rounds the argument. For example, 1.49 → 1.0, 1.5 → 2.0. Argument: |
|
Rounds the argument down. For example, 1.49 → 1.0, 1.5 → 1.0. Argument: |
|
Rounds the argument up. For example, 1.49 → 2.0, 1.5 → 2.0. Argument: |
|
Finds the sign of the argument. Argument: |
|
Finds the sign of the argument. Argument: |
|
Gets the number with the magnitude of the first argument and the sign of the second argument. Arguments: 1 — |
|
Gets the number with the magnitude of the first argument and the sign of the second argument. Arguments: 1 — |
String operations
Function |
Description |
|
Gets the length of the specified string. Argument: |
|
Determines whether the string (Argument 1) contains the specified substring (Argument 2). Arguments: 1 — Source |
|
Gets the part of the string (Argument 1) located in the range defined by Arguments 2 and 3. Arguments: 1 — Source |
|
Finds and replaces all occurrences of the substring (Argument 2) in the source string (Argument 1) with the string specified in Argument 3. Arguments: 1 — Source |
|
Gets the index of the first occurrence of the substring (Argument 2) in the string (Argument 1). Arguments: 1 — Source |
|
Gets the index of the last occurrence of the substring (Argument 2) in the string (Argument 1). Arguments: 1 — Source |
|
Trims whitespace from both ends of the specified string. Argument: |
|
Trims whitespace from the beginning of the specified string. Argument: |
|
Trims whitespace from the end of the specified string. Argument: |
|
Converts the specified string to uppercase. Argument: |
|
Converts the specified string to lowercase. Argument: |
|
Pads the beginning of the string with the specified characters until it reaches the specified length. Arguments: 1 — Source For example: |
|
Converts the number to a string and pads the beginning of the resulting string with the specified characters until it reaches the specified length. Arguments: 1 — Source For example: |
|
Pads the end of the string with the specified characters until it reaches the specified length. Arguments: 1 — Source For example: |
|
Converts the number to a string and pads the end of the resulting string with the specified characters until it reaches the specified length. Arguments: 1 — Source For example: |
Color operations
Function |
Description |
|
Gets the alpha component of the specified color. Argument: |
|
Gets the red component of the specified color. Argument: |
|
Gets the green component of the specified color. Argument: |
|
Gets the blue component of the specified color. Argument: |
|
Sets the alpha value of the specified color. Arguments: 1 — |
|
Sets the red value of the specified color. Arguments: 1 — |
|
Sets the green value of the specified color. Arguments: 1 — |
|
Sets the blue value of the specified color. Arguments: 1 — |
|
Creates a hex color code with the specified alpha, red, green, and blue values. Arguments: 1 — |
|
Creates a hex color code with the specified red, green, and blue values. Sets the alpha component value to Arguments: 1 — |
Date and time operations
Function |
Description |
|
Creates a datetime value from the specified Unix timestamp. Argument: |
|
Creates a datetime value for the current time. No arguments. |
|
Adds the specified number of milliseconds to the original datetime. Arguments: 1 — Original |
|
Sets the year value of the original datetime. Arguments: 1 — Original |
|
Sets the month value of the original datetime. Arguments: 1 — Original |
|
Sets the day of month value of the original datetime. Arguments: 1 — Original |
|
Sets the hours value of the original datetime. Arguments: 1 — Original |
|
Sets the minutes value of the original datetime. Arguments: 1 — Original |
|
Sets the seconds value of the original datetime. Arguments: 1 — Original |
|
Sets the milliseconds value of the original datetime. Arguments: 1 — Original |
|
Gets the year value of the original datetime. Argument: Original |
|
Gets the month number value of the original datetime. Argument: Original |
|
Gets the day of month value of the original datetime. Argument: Original |
|
Gets the day of week value of the original datetime, where Argument: Original |
|
Gets the hours value of the original datetime. Argument: Original |
|
Gets the minutes value of the original datetime. Argument: Original |
|
Gets the seconds value of the original datetime. Argument: Original |
|
Gets the milliseconds value of the original datetime. Argument: Original |
|
Converts the interval in milliseconds to Argument: For example, |
|
Converts the interval in milliseconds to seconds and rounds the result down. Argument: For example, |
|
Converts the interval in milliseconds to Argument: For example, |
|
Converts the interval in milliseconds to minutes and rounds the result down. Argument: For example, |
|
Converts the interval in milliseconds to Argument: For example, |
|
Converts the interval in milliseconds to hours and rounds the result down. Argument: For example, |
|
Converts the interval in milliseconds to days and rounds the result down. Argument: For example, |
|
Converts the interval in milliseconds to weeks and rounds the result down. Argument: For example, |
Learn more
Follow DivKit news in the Telegram channel: http://t.me/divkit_news
You can also discuss topics of interest in the DivKit user community in Telegram: https://t.me/divkit_community_ru