ABCalc Function Reference

This document provides a complete reference of all functions available in ABCalc, organized by category.

Table of Contents


Arithmetic

Functions for basic mathematical operations, logarithms, and number manipulation.

Abs

Description: Returns the absolute value of the argument (value for a positive argument or 0 and -value for a negative argument).

Parameters:

  • value: The value to apply the function to

Acos (Arccos)

Description: Returns the arccosine of the argument - the angle whose cosine is the specified number. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • value: The value to apply the function to

Arccot

Description: Returns the arccotangent of the argument - the angle whose cotangent is the specified number. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • value: The value to apply the function to

Arccsc

Description: Returns the arccosecant of the argument - the angle whose cosecant is the specified number. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • value: The value to apply the function to

Arcsec

Description: Returns the arcsecant of the argument - the angle whose secant is the specified number. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • value: The value to apply the function to

Asin (Arcsin)

Description: Returns the arcsine of the argument - the angle whose sine is the specified number. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • value: The value to apply the function to

Atan (Arctan)

Description: Returns the arctangent of the argument - the angle whose tangent is the specified number. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • value: The value to apply the function to

Atan2

Description: Returns the angle whose tangent is the quotient of two specified numbers 'x' and 'y'. The value is returned in radians or degrees depending on the Deg/Rad switch.

Parameters:

  • x: The first argument to the function
  • y: The second argument to the function

Cbrt

Description: Returns the cubic root of a specified number.

Parameters:

  • value: The number whose cubic root is to be found.

Ceiling

Description: Returns the smallest integral value greater than or equal to the specified number.

Parameters:

  • value: The value to apply the function to

Cos

Description: Returns the cosine of the angle value. Use the Deg/Rad switch to specify what unit the value uses.

Parameters:

  • value: The value to apply the function to

Cosh

Description: Returns the hyperbolic cosine of the argument.

Parameters:

  • value: The value to apply the function to

Cot

Description: Returns the cotangent of the angle value. The cotangent of an angle is the reciprocal of the tangent. Use the Deg/Rad switch to specify what unit the value uses.

Parameters:

  • value: The value to apply the function to

Coth

Description: Returns the hyperbolic cotangent of the argument.

Parameters:

  • value: The value to apply the function to

Csc

Description: Returns the cosecant of the angle value. The cosecant is the reciprocal of the sine. Use the Deg/Rad switch to specify what unit the value uses.

Parameters:

  • value: The value to apply the function to

Csch

Description: Returns the hyperbolic cosecant of the argument.

Parameters:

  • value: The value to apply the function to

Exp

Description: Returns e raised to the specified power.

Parameters:

  • power: The power to raise e to

Floor

Description: Returns the largest integral value less than or equal to the specified number.

Parameters:

  • value: The value to apply the function to

GCD

Description: Returns the greatest common divisor (GCD) of two integers — the largest positive integer that divides both numbers without a remainder.

Parameters:

  • a: The first integer value
  • b: The second integer value

IEEERemainder

Description: Returns the remainder resulting from the division of a specified number by another specified number.

Parameters:

  • x: The first argument to the function
  • y: The second argument to the function

IsPrime

Description: Checks whether the given value is a prime number.

Parameters:

  • value: The value to apply the function to

LCM

Description: Returns the least common multiple (LCM) of two integers — the smallest positive integer that is divisible by both numbers.

Parameters:

  • a: The first integer value
  • b: The second integer value

Ln

Description: Returns the natural (base e) logarithm of a specified number.

Parameters:

  • value: The value to apply the function to

Log

Description: Returns the logarithm of a specified number in a specified base.

Parameters:

  • value: The number whose logarithm is to be found
  • base: The base of the logarithm

Log10

Description: Returns the base 10 logarithm of a specified number.

Parameters:

  • value: The value to apply the function to

Log2

Description: Returns the base 2 logarithm of a specified number.

Parameters:

  • value: The value to apply the function to

Nroot

Description: Returns the n-th root of a number.

Parameters:

  • radicand: The number to find the root of
  • degree: The degree of the root

PercentDiff

Description: Calculates the percentage difference between two values.

Parameters:

  • x: The first value
  • y: The second value

PercentOf

Description: Calculates what percentage one value is of another.

Parameters:

  • x: The value to calculate the percentage of
  • y: The base value

Pow

Description: Returns the value raised to the specified power.

Parameters:

  • value: The value to apply the function to
  • power: The power to raise the value to

Round

Description: Returns the number rounded to the specified precision or to an integer number if precision is not specified.

Parameters:

  • value: The value to apply the function to
  • precision (optional): The number of fractional digits in the return value. The argument must be an integer.
  • away_from_zero (optional): When 'true' or non-zero, specifies that when a number is halfway between two others, it's rounded toward the nearest number that's away from zero. If omitted, 'false' or zero, rounding of such values is done towards zero.

Sec

Description: Returns the secant of the angle value. The secant is the reciprocal of the cosine. Use the Deg/Rad switch to specify what unit the value uses.

Parameters:

  • value: The value to apply the function to

Sech

Description: Returns the hyperbolic secant of the argument.

Parameters:

  • value: The value to apply the function to

Sign

Description: Returns the sign of a number (-1, 0, or 1).

Parameters:

  • value: The value to apply the function to

Sin

Description: Returns the sine of the angle value. Use the Deg/Rad switch to specify what unit the value uses.

Parameters:

  • value: The value to apply the function to

Sinh

Description: Returns the hyperbolic sine of the argument.

Parameters:

  • value: The value to apply the function to

Sqrt

Description: Returns the square root of a specified number.

Parameters:

  • value: The number whose square root is to be found

Tan

Description: Returns the tangent of the angle value. Use the Deg/Rad switch to specify what unit the value uses.

Parameters:

  • value: The value to apply the function to

Tanh

Description: Returns the hyperbolic tangent of the argument.

Parameters:

  • value: The value to apply the function to

Truncate

Description: Calculates the integral part of a number.

Parameters:

  • value: The value to apply the function to

Rnd

Description: Generates a random number within the specified range.

Parameters:

  • lower_bound (optional): The lower bound of the range (default: 0)
  • upper_bound: The upper bound of the range

Trigonometry

All trigonometric functions are documented in the Arithmetic section. They return values in radians or degrees depending on the Deg/Rad switch setting.

Functions include:


Scientific

Functions for permutations, combinations, and scientific calculations.

nPr

Description: Returns the number of permutations, i.e., the number of ways to arrange r objects out of n distinct objects, where the order matters.

Parameters:

  • n: The total number of objects
  • r: The number of objects to arrange

nCr

Description: Returns the number of combinations, i.e., the number of ways to select r objects from n distinct objects, where the order does not matter.

Parameters:

  • n: The total number of objects
  • r: The number of objects to select

Statistical Functions

See the Statistical section for functions available in multiple categories:


Financial

Functions for time-value-of-money calculations, investment analysis, and depreciation.

CAGR

Description: Calculates the constant annual growth rate that would take an initial value to a final value over a specified number of periods, assuming compounding.

Parameters:

  • ival: The starting value at the beginning of the measurement period. Must be a positive number.
  • fval (optional): The ending value at the end of the measurement period. Must be a positive number.
  • num_periods: The number of periods

FV

Description: Calculates the Future Value (FV) of an investment.

Parameters:

  • rate: The interest rate per period (as a decimal, e.g., 0.05, or as per cent, e.g., 5%)
  • num_periods: The total number of compounding periods over which the investment grows
  • pmt: The payment made in each period. This value is constant and usually includes both principal and interest. Payments are typically entered as negative values (cash outflow).
  • pval (optional): The initial amount of money invested or saved at the start (amount you have now). If omitted, it is assumed to be 0.
  • type (optional): When payments are due: use 0 or false to denote the end of period (default), or use 1 or true for the beginning.

IRR

Description: Calculates the interest rate at which the Net Present Value (NPV) of a series of cash flows equals zero.

Parameters:

  • values: A sequence of cash flow values ordered by time which must be a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)"). The first value must usually be a negative number (representing the initial investment or cost). Subsequent values represent income (positive) or further payments (negative). At least one positive and one negative value are required.
  • guess (optional): An initial estimate of the interest rate used to start the calculation. If omitted, 10% is used.
  • max_iterations (optional): The maximum number of calculation steps allowed before stopping. If omitted, 1000 is used.
  • tolerance (optional): The acceptable numerical error for considering the result accurate. If omitted, 0.0000001 is used.

DCF

Description: Calculates the present value of a series of future cash flows by discounting each cash flow back to "today" using a discount rate.

Parameters:

  • discount_rate: The discount rate per period (for example, per year) that represents the required rate of return. This value is entered as a decimal, e.g., 0.05, or as per cent, e.g., 5%.
  • values: A sequence of projected cash flows per period. Each element is the cash flow at the end of that period. The sequence must be provided as a list of numbers in a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)").
  • start_period (optional): If specified, a value of 0 or 'false' indicates that the first number in the sequence of values indicates the cache flow today; otherwise, the first number indicates the first cash flow that occurs at the end of the first period (typical).

NPER

Description: Calculates the number of equal time periods required for an investment or loan to reach a specified future value, given a fixed interest rate per period and constant periodic payments.

Parameters:

  • rate: The interest rate per period (as a decimal, e.g., 0.05, or as per cent, e.g., 5%).
  • payment: Payment made each period. Typically negative if it represents an outgoing payment.
  • present_value: The present value — the total amount borrowed (loan principal) or the current value of an investment.
  • future_value (optional): Future value — the remaining balance after the last payment. If omitted, defaults to 0.
  • type (optional): Payment timing: use 0 or false to denote the end of period (default), or use 1 or true for the beginning.

NPV

Description: Calculates the present value of a series of future cash flows, discounted using a fixed rate. It is commonly used to evaluate the profitability of an investment.

Parameters:

  • discount_rate: The rate used to discount future cash flows back to their present value. This value is expressed per period (for example, per year) and is entered as a decimal, e.g., 0.05, or as per cent, e.g., 5%.
  • values: A sequence of cash flow amounts occurring at the end of each period expressed either as a list of numbers in a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or as several numeric values in separate arguments. Positive values represent income, negative values represent expenses. The first value corresponds to the first period (period 1).

PMT

Description: Calculates the fixed periodic payment required to pay off a loan or to achieve a target future value for an annuity, assuming a constant interest rate and equal payments.

Parameters:

  • rate: The interest rate per period (as a decimal, e.g., 0.05, or as per cent, e.g., 5%)
  • num_periods: The total number of payment periods
  • pval: The present value — the total amount borrowed (loan principal) or the current value of an investment.
  • fval (optional): Future value — the remaining balance after the last payment. If omitted, defaults to 0.
  • type (optional): When payments are due: use 0 or false to denote the end of period (default), or use 1 or true for the beginning.

PV

Description: Calculates the Present Value (PV) of an investment.

Parameters:

  • rate: The interest rate per period (as a decimal, e.g., 0.05, or as per cent, e.g., 5%)
  • num_periods: The total number of compounding periods over which the investment grows
  • pmt: The payment made in each period. This value is constant and usually includes both principal and interest. Payments are typically entered as negative values (cash outflow).
  • fval: Future value (amount you want to have after the last payment)
  • type (optional): When payments are due: use 0 or false to denote the end of period (default), or use 1 or true for the beginning.

ROI

Description: Measures how much profit or loss an investment generates relative to its cost.

Parameters:

  • cost: The total amount of money initially invested. This value must be greater than zero.
  • return: The final value received from the investment.

SKEW

Description: Measures how asymmetric a dataset is around its mean.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments. At least three (3) values must be provided.

SLD

Description: Calculates the constant annual depreciation expense of an asset when its value decreases evenly over its useful life.

Parameters:

  • cost: The initial purchase price or acquisition cost of the asset.
  • salvage_value: The estimated value of the asset at the end of its useful life.
  • useful_life: The total number of years the asset is expected to be used.

Statistical Functions in Financial

See the Statistical section for functions available in multiple categories:


Statistical

Functions for statistical analysis and data analysis.

Avg

Description: Returns the average of the arguments.

Parameters:

  • values: Either a list of numeric values as one argument or one or more numeric values as several arguments

Count

Description: Returns the number of elements in the list or the length of a string.

Parameters:

  • values: Either a list of values or a string as one argument or one or more values as several arguments. The elements do not have to be sorted.

Corr (Pearson)

Description: Measures correlation, i.e., quantifies linear relationship between two variables in arguments. Both arguments must be lists with the same number of elements. At least two elements are required in each list.

Parameters:

  • x: A sequence of numerical observations for the first variable; a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)"). Each value represents one measurement.
  • y: A sequence of numerical observations for the second variable; a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)"). Each value represents one measurement.

Result: A number in the range −1 to +1:

  • +1 → perfect positive linear relationship
  • 0 → no linear relationship
  • −1 → perfect negative linear relationship

Cov (Covar)

Description: Measures covariance, i.e., how two variables change together. Both arguments must be lists with the same number of elements.

Parameters:

  • x: A sequence of numerical values representing the first variable; a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)").
  • y: A sequence of numerical values representing the second variable; a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)").
  • type (optional): If specified, a value of 1 or 'true' indicates population covariance; otherwise, sample covariance is calculated.

Result: A positive covariance means the variables tend to increase together. A negative covariance means one tends to increase while the other decreases. A covariance of zero indicates no linear co-variation.


GM

Description: The geometric mean of a set of n values is the n-th root of the product of those values.

Parameters:

  • values: A sequence of positive numeric values for which the geometric mean is calculated. This must be either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments.

HM

Description: The harmonic mean is a type of average that is calculated as the number of values divided by the sum of their reciprocals.

Parameters:

  • values: A sequence of non-zero numeric values for which the harmonic mean is calculated. This must be either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments.

IQR

Description: Returns the difference between the value below which 75% of the data falls and the value below which 25% of the data falls.

Parameters:

  • values: Either a list of numeric values as one argument or one or more numeric values as several arguments. The elements do not have to be sorted.

Max

Description: Finds the maximal number in a dataset.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments.

Med

Description: Returns the middle value of a dataset after sorting it in ascending order.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments. The elements do not have to be sorted.

Min

Description: Finds the minimal number in a dataset.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments.

Mode

Description: Identifies the value or values that occur most frequently in a dataset. If multiple values share the same highest frequency, all of them are returned.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments. At least one value is required. Values may repeat.

Norm

Description: Calculates the "length" or "magnitude" of a vector.

Parameters:

  • values: Either a list of numbers as a single argument or one or more numeric values as separate arguments.

PCTL

Description: Calculates the value below which a given percentage of data falls.

Parameters:

  • values: A list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)").
  • percentile: The desired percentile, expressed as a number between 0 and 100. 0 returns the minimum value, 50 returns the median, 100 returns the maximum value.

Q1

Description: Returns the value below which 25% of the data falls.

Parameters:

  • values: Either a list of numeric values as one argument or one or more numeric values as several arguments. The elements do not have to be sorted.

Q3

Description: Returns the value below which 75% of the data falls.

Parameters:

  • values: Either a list of numeric values as one argument or one or more numeric values as several arguments. The elements do not have to be sorted.

Range

Description: Finds the difference between minimal and maximal numbers in a dataset.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments.

Std

Description: Measures how much the values in a dataset deviate from their mean.

Parameters:

  • values: A list of numeric values representing the dataset with at least two values for sample standard deviation and one value for population standard deviation; a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)").
  • type (optional): If specified, a value of 1 or 'true' indicates population standard deviation; otherwise, sample standard deviation is calculated.

Sum

Description: Adds all numbers in a dataset.

Parameters:

  • values: Either a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several numeric values as separate arguments.

Var

Description: Measures how far values in a dataset are spread out from their mean. It is the average of the squared deviations from the mean.

Parameters:

  • values: A list of numeric values representing the dataset with at least two values for sample standard deviation and one value for population standard deviation; a list of numbers as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)").
  • type (optional): If specified, a value of 1 or 'true' indicates population standard deviation; otherwise, sample standard deviation is calculated.

WA

Description: Calculates the weighted average of values, where each value is multiplied by its corresponding weight before averaging.

Parameters:

  • values: A list of numeric values (either as a single argument enclosed in parentheses, e.g. "(1;2;3)" or as separate arguments).
  • weights: A list of numeric weights corresponding to each value (either as a single argument enclosed in parentheses or as separate arguments).

Z (ZScore)

Description: Standardizes a value based on mean and standard deviation.

Parameters:

  • value: The value to standardize
  • mean: The mean
  • standardDeviation: The standard deviation

Date and Time

Functions for date and time operations, conversions, and calculations.

Today

Description: Returns current date.

Parameters:

  • utc (optional): The optional flag that indicates that the date must be returned in UTC time zone. If not set or is set to 'false' or 0, local time zone is used.

Now

Description: Returns current date and time.

Parameters:

  • utc (optional): The optional flag that indicates that the date and time must be returned in UTC time zone. If not set or is set to 'false' or 0, local time zone is used.

MSToTime

Description: Converts a number of milliseconds to a time span.

Parameters:

  • value: The number of milliseconds to convert

TimeToMS

Description: Converts a time span to the number of milliseconds.

Parameters:

  • value: The time span to convert to milliseconds

DateToEpoch

Description: Converts a date to the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds.

Parameters:

  • value: The date to convert to epoch time

DateToEpochMS

Description: Converts a date to the number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds.

Parameters:

  • value: The date to convert to epoch time

EpochToDate

Description: Converts the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds, to a date.

Parameters:

  • value: The epoch time to convert to a date

EpochMSToDate

Description: Converts the number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds, to a date.

Parameters:

  • value: The epoch time to convert to a date

Weekday

Description: Returns the day of the week for a given date.

Parameters:

  • value: The date to get the day of the week for

String and Char

Functions for string manipulation, encoding, decoding, and character operations.

StrLen

Description: Returns the length of the specified string.

Parameters:

  • value: The string whose length is to be calculated.

StrPos

Description: Returns the position of the first occurrence of a substring in a string. The position is 1-based, i.e., the first character in the string is at position 1. If the substring is not found, the function returns 0.

Parameters:

  • haystack: The string to search in.
  • needle: The string to search for.

StrPosZ

Description: Returns the zero-based position of the first occurrence of a substring in a string. The position is 0-based, i.e., the first character in the string is at position 0. If the substring is not found, the function returns -1.

Parameters:

  • haystack: The string to search in.
  • needle: The string to search for.

StrLastPos

Description: Returns the one-based position of the last occurrence of a substring in a string. The position is 1-based, i.e., the first character in the string is at position 1. If the substring is not found, the function returns 0.

Parameters:

  • haystack: The string to search in.
  • needle: The string to search for.

StrLastPosZ

Description: Returns the zero-based position of the last occurrence of a substring in a string. The position is 0-based, i.e., the first character in the string is at position 0. If the substring is not found, the function returns -1.

Parameters:

  • haystack: The string to search in.
  • needle: The string to search for.

SubStr

Description: Returns the substring of a string starting at the specified one-based position and of the specified length.

Parameters:

  • source: The string to extract the substring from.
  • position: The position to start the extraction from. The position is 1-based, i.e., the first character in the string is at position 1. If the position is negative, it is counted from the end of the string.
  • length (optional): The number of characters to extract. If omitted or zero, the substring from the start position to the end of the string is returned. If negative, it specifies the number of characters to exclude from the end of the string.

SubStrZ

Description: Returns the substring of a string starting at the specified zero-based position and of the specified length.

Parameters:

  • source: The string to extract the substring from.
  • position: The zero-based position to start the extraction from. The position is 0-based, i.e., the first character in the string is at position 0. If the position is negative, it is counted from the end of the string.
  • length (optional): The number of characters to extract. If omitted or zero, the substring from the start position to the end of the string is returned. If negative, it specifies the number of characters to exclude from the end of the string.

Char

Description: Returns the character corresponding to the specified ASCII code.

Parameters:

  • code: The ASCII code of the character to return.

CharCode

Description: Returns the Unicode code of a character.

Parameters:

  • value: The character or a string with one character to get the Unicode code from.

DecodeBase16

Description: Base16 decoding (also known as hexadecimal decoding) converts a Base16-encoded text string back into binary data.

Parameters:

  • value: The Base16-encoded string to decode

DecodeBase64

Description: Base64 decoding converts a Base64-encoded text string back into binary data.

Parameters:

  • value: The Base64-encoded string to decode

DecodeJson

Description: Decodes a JSON-encoded string by unescaping special characters.

Parameters:

  • value: The JSON-encoded string to decode

DecodeUrl

Description: Decodes a URL-encoded string by replacing each '%' followed by two hexadecimal digits with the corresponding ASCII character.

Parameters:

  • value: The URL-encoded string to decode

EncodeBase16

Description: Base16 encoding (also known as hexadecimal encoding) converts binary data into a text string using 16 printable characters (0-9 and A-F).

Parameters:

  • value: The value to encode

EncodeBase64

Description: Base64 encoding converts binary data into a text string using 64 printable characters.

Parameters:

  • value: The value to encode

EncodeJson

Description: Encodes a string to be safely included in a JSON string by escaping special characters.

Parameters:

  • value: The value to encode

EncodeUrl

Description: Encodes a string to be safely included in a URL by replacing unsafe ASCII characters with a '%' followed by two hexadecimal digits.

Parameters:

  • value: The value to encode

StrFormat

Description: Formats a message, replacing placeholders with actual values.

Parameters:

  • message: The message to return. Should contain placeholders as numbers, i.e. {n}, where 'n' is the 0-based index of the argument.
  • message_args: The arguments that should be used to replace placeholders. The first argument has the index 0.

StrLower

Description: Converts all characters in the specified string to lowercase.

Parameters:

  • value: The string to convert to lowercase

StrLTrim

Description: Removes all leading white-space characters from the specified string.

Parameters:

  • value: The string to trim
  • trim_chars (optional): A string containing all characters to be removed from the beginning of the value string. If omitted or empty, white-space characters are removed.

StrPadLeft

Description: Returns a new string that right-aligns the characters in the specified string by padding them on the left with spaces or a specified character, for a specified total length.

Parameters:

  • value: The string to pad on the left
  • total_width: The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
  • padding_char (optional): The character to use for padding. If omitted, a space character is used.

StrPadRight

Description: Returns a new string that left-aligns the characters in the specified string by padding them on the right with spaces or a specified character, for a specified total length.

Parameters:

  • value: The string to pad on the right
  • total_width: The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.
  • padding_char (optional): The character to use for padding. If omitted, a space character is used.

StrRTrim

Description: Removes all trailing white-space characters from the specified string.

Parameters:

  • value: The string to trim
  • trim_chars (optional): A string containing all characters to be removed from the end of the value string. If omitted or empty, white-space characters are removed.

StrTrim

Description: Removes all leading and trailing white-space characters from the specified string.

Parameters:

  • value: The string to trim
  • trim_chars (optional): A string containing all characters to be removed from the start and end of the value string. If omitted or empty, white-space characters are removed.

StrUpper

Description: Converts all characters in the specified string to uppercase.

Parameters:

  • value: The string to convert to uppercase

ToString

Description: Converts a value to its string representation.

Parameters:

  • value: The value to convert to a string

HashSHA256

Description: Computes the SHA-256 hash of the UTF8 representation of the specified string and returns it as a hexadecimal string.

Parameters:

  • value: The value to hash

General

General-purpose functions for control flow, list creation, and utilities.

Iff

Description: Evaluates a condition and returns one of two values depending on the result of evaluation. Corresponds to the 'if' statement.

Parameters:

  • condition: The condition to evaluate.
  • value_true: The value to return if the condition evaluates to 'true'.
  • value_false (optional): The value to return if the condition evaluates to 'false'. If this parameter is not specified, 'null' is assumed.

Ifs

Description: Evaluates a series of conditions and returns the value associated with the condition that evaluates to 'true'. If none of conditions match, returns the 'other' value. Odd arguments (1, 3, and so on) are conditions, even arguments (2, 4, etc.) are values to return if the previous condition matches.

Parameters:

  • condition_1: The first condition to match.
  • value_1: The value to return if the first condition evaluates to 'true'.
  • rest: Optional consequent pairs of conditions and values.
  • value_other (optional): The value to return if no conditions match. If this parameter is not specified, 'null' is assumed.

In

Description: Checks whether the given value is present in the list.

Parameters:

  • needle: The value to search for.
  • haystack: A sequence of values to search in. This must be either a list of values as a single argument (i.e., enclosed in parentheses, e.g. "(1;2;3)") or several values as separate arguments.

Error

Description: Aborts the evaluation of an expression and shows an error message.

Parameters:

  • message: The message to show. May contain placeholders as numbers, i.e. {n}, where 'n' is the 0-based index of the argument.
  • message_args: Optional arguments that should be used to replace placeholders. The first argument has the index 0.

Guid

Description: Generates a new GUID (Globally Unique Identifier).

Parameters:

  • format (optional): The format of the GUID. The default is "D" (or 0) for "00000000-0000-0000-0000-000000000000". Other formats include "N" or 1 for "00000000000000000000000000000000", "B" or 2 for "{00000000-0000-0000-0000-000000000000}", "P" or 3 for "(00000000-0000-0000-0000-000000000000)", and "X" or 4.

Ulid

Description: Generates a new ULID (Universally Unique Lexicographically Sortable Identifier) value.

Parameters:

  • None

Count (Statistical)

See Count in the Statistical section.


Max (Statistical)

See Max in the Statistical section.


Min (Statistical)

See Min in the Statistical section.


MakeList

Description: Creates a list with the specified number of elements.

Parameters:

  • size: The number of elements in the list
  • value (optional): The initial value to set each element to

MakeStr

Description: Creates a string with a value repeated one or more times.

Parameters:

  • size: The number of repetitions of the value
  • value: The value to make a string from

Conversion

Unit conversion function for converting between various units of measurement.

Convert

Description: Converts a value from one unit of measurement to another. Units of measurement can be specified as names in quotes (e.g. "g" for grams), as constants in the form 'unit_{name}' (without quotes), or as numeric values.

Supported unit categories include:

  • Length: mm, cm, dm, m, km, mkm, nm, in, ft, yd, mi, nmi
  • Area: mm2, cm2, dm2, m2, km2, ac, ar, ha, in2, ft2, yd2, mi2
  • Volume: ml, cc, dl, l, m3, in3, ft3, yd3, galuk, galus, gal, qtuk, qtus, ptuk, ptus, flozuk, flozus, floz, cup, cupm, cupuk, cupus, tsp, tspm, tspuk, tspus, tbsp, tbspm, tbspuk, tbspus, bbl
  • Weight: mg, g, kg, t, tuk, tus, st, gr, oz, ozt, lb, ct
  • Temperature: C, F, K
  • Speed: mps, mpm, kmps, kmpm, kmph, ftps, inps, knot, ydps, mph, miph, mach
  • Pressure: atm, pa, hpa, kpa, mpa, mbar, bar, kgcm2, psi, mmhg, inhg
  • Force: N, kN, dyn, kgf, gf, lbf, ozf, tonf, tonfus
  • Power: W, kW, MW, GW, hp, BTUh, ergs
  • Energy: J, kJ, MJ, GJ, kal, kkal, Ws, Wh, kWh, MWh, GWh, ftlb, btu, ev, kev, mev, gev, erg
  • Fuel consumption: lhkm, mpg, mpgus, mpguk, kml, ghmi, lkm, lmi

Parameters:

  • value: The value to convert
  • fromUnit: The unit of measurement of the value (can be a unit name in quotes, a constant name, or a numeric value)
  • toUnit: The unit of measurement of the result (can be a unit name in quotes, a constant name, or a numeric value)


Color

Functions for creating, converting, manipulating, and analyzing colors. Colors are represented as packed ARGB integers (long) in 0xAARRGGBB format — alpha in bits 24–31, red 16–23, green 8–15, blue 0–7. Use RGB() / RGBA() / FROMHEX() to create colors and HEX() to format them back to strings.

All color functions are available under their short names (e.g. RGB) and under Color-prefixed aliases (e.g. ColorRGB).


ALPHA (alias: ColorAlpha)

Description: Sets the alpha (opacity) channel of a color. Returns a new color with the specified alpha value and unchanged RGB channels.

Parameters:

  • color: Packed ARGB color value
  • alpha: New alpha value (integer, 0–255; 0 = fully transparent, 255 = fully opaque)
  • result: ARGB color value with updated alpha

ARGB (alias: ColorARGB)

Description: Creates a color from alpha, red, green, and blue channel values. Returns a packed ARGB integer.

Parameters:

  • a: Alpha channel value (integer, 0–255; 0 = fully transparent, 255 = fully opaque)
  • r: Red channel value (integer, 0–255)
  • g: Green channel value (integer, 0–255)
  • b: Blue channel value (integer, 0–255)
  • result: Packed ARGB color value

CONTRAST (alias: ColorContrast)

Description: Returns the WCAG 2.x contrast ratio between two colors (range 1–21). A ratio of 4.5:1 or higher meets AA accessibility requirements for normal text.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • result: Contrast ratio (1–21)

DARKEN (alias: ColorDarken)

Description: Darkens a color by decreasing its HSL lightness by the specified amount. The result is clamped to the valid range.

Parameters:

  • color: Packed ARGB color value
  • amount: Amount to subtract from lightness (0–1)
  • result: Darkened ARGB color value

DELTAE (alias: ColorDeltaE)

Description: Returns the CIEDE2000 perceptual color difference between two colors. Equivalent to DELTAE2000.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • result: CIEDE2000 color difference (≥0)

DELTAE2000 (alias: ColorDeltaE2000)

Description: Returns the CIEDE2000 perceptual color difference between two colors (Sharma 2005). A value of 0 means identical colors; values above ~2–3 are visibly different.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • result: CIEDE2000 color difference (≥0)

DELTAE76 (alias: ColorDeltaE76)

Description: Returns the CIE76 Euclidean color difference between two colors in L*a*b* space. Simpler and faster than DELTAE2000 but less perceptually uniform for large differences.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • result: CIE76 color difference (≥0)

DESATURATE (alias: ColorDesaturate)

Description: Decreases the saturation of a color in HSL space by the specified amount. The result is clamped to the valid range.

Parameters:

  • color: Packed ARGB color value
  • amount: Amount to subtract from saturation (0–1)
  • result: Less saturated ARGB color value

FROMHEX (alias: ColorFromHex)

Description: Parses a CSS hex color string and returns a packed ARGB integer. Accepts #RRGGBB or #AARRGGBB format (case-insensitive, # is required).

Parameters:

  • hex: Hex color string in #RRGGBB or #AARRGGBB format (e.g. "#FF0000" for red)
  • result: Packed ARGB color value

FROMHSL (alias: ColorFromHSL)

Description: Creates a packed ARGB color from HSL components (hue, saturation, lightness). Alpha is set to 255 (fully opaque).

Parameters:

  • h: Hue in degrees (0–360)
  • s: Saturation (0–1)
  • l: Lightness (0–1)
  • result: Packed ARGB color value

FROMHSV (alias: ColorFromHSV)

Description: Creates a packed ARGB color from HSV components (hue, saturation, value). Alpha is set to 255 (fully opaque).

Parameters:

  • h: Hue in degrees (0–360)
  • s: Saturation (0–1)
  • v: Value/brightness (0–1)
  • result: Packed ARGB color value

FROMLAB (alias: ColorFromLab)

Description: Creates a packed ARGB color from CIE L*a*b* components. Out-of-gamut values are clamped to 0–255 per channel. Alpha is set to 255.

Parameters:

  • l: Lightness (0–100)
  • a: Green–red axis (approx. −128–128)
  • b: Blue–yellow axis (approx. −128–128)
  • result: Packed ARGB color value

FROMLCH (alias: ColorFromLCH)

Description: Creates a packed ARGB color from CIE LCH components. Alpha is set to 255.

Parameters:

  • l: Lightness (0–100)
  • c: Chroma (≥0)
  • h: Hue angle in degrees (0–360)
  • result: Packed ARGB color value

FROMOKLAB (alias: ColorFromOKLab)

Description: Creates a packed ARGB color from OKLab components. Out-of-gamut values are clamped. Alpha is set to 255.

Parameters:

  • l: Perceptual lightness (0–1)
  • a: Green–red axis (approx. −0.5–0.5)
  • b: Blue–yellow axis (approx. −0.5–0.5)
  • result: Packed ARGB color value

FROMOKLCH (alias: ColorFromOKLCH)

Description: Creates a packed ARGB color from OKLCH components. Alpha is set to 255.

Parameters:

  • l: Perceptual lightness (0–1)
  • c: Chroma (≥0)
  • h: Hue angle in degrees (0–360)
  • result: Packed ARGB color value

HEX (alias: ColorHex)

Description: Formats a packed ARGB color value as a CSS hex string. Returns #RRGGBB when alpha is 255, or #AARRGGBB otherwise.

Parameters:

  • color: Packed ARGB color value (as returned by RGB, RGBA, FROMHEX, etc.)
  • result: Hex color string

LERPCOLOR (alias: ColorLerp)

Description: Linearly interpolates between two colors in RGB space. t=0 returns the first color, t=1 returns the second.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • t: Interpolation factor (0–1)
  • result: Interpolated ARGB color value

LERPCOLORLAB (alias: ColorLerpLab)

Description: Linearly interpolates between two colors in CIE L*a*b* space, then converts the result back to a packed ARGB color. Produces perceptually smoother gradients than RGB interpolation.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • t: Interpolation factor (0–1)
  • result: Interpolated ARGB color value

LERPCOLOROKLAB (alias: ColorLerpOKLab)

Description: Linearly interpolates between two colors in OKLab space, then converts the result back to a packed ARGB color. Produces perceptually uniform gradients.

Parameters:

  • color1: First packed ARGB color value
  • color2: Second packed ARGB color value
  • t: Interpolation factor (0–1)
  • result: Interpolated ARGB color value

LIGHTEN (alias: ColorLighten)

Description: Lightens a color by increasing its HSL lightness by the specified amount. The result is clamped to the valid range.

Parameters:

  • color: Packed ARGB color value
  • amount: Amount to add to lightness (0–1)
  • result: Lightened ARGB color value

LUMINANCE (alias: ColorLuminance)

Description: Returns the relative luminance of a color according to WCAG 2.x (0 = black, 1 = white).

Parameters:

  • color: Packed ARGB color value
  • result: Relative luminance (0–1)

RGB (alias: ColorRGB)

Description: Creates a color from red, green, and blue channel values. Returns a packed ARGB integer with full opacity (alpha = 255).

Parameters:

  • r: Red channel value (integer, 0–255)
  • g: Green channel value (integer, 0–255)
  • b: Blue channel value (integer, 0–255)
  • result: Packed ARGB color value

RGBA (alias: ColorRGBA)

Description: Creates a color from red, green, blue, and alpha channel values. Returns a packed ARGB integer.

Parameters:

  • r: Red channel value (integer, 0–255)
  • g: Green channel value (integer, 0–255)
  • b: Blue channel value (integer, 0–255)
  • a: Alpha channel value (integer, 0–255; 0 = fully transparent, 255 = fully opaque)
  • result: Packed ARGB color value

ROTATEHUE (alias: ColorRotateHue)

Description: Rotates the hue of a color in HSL space by the specified number of degrees. The hue wraps around at 360°.

Parameters:

  • color: Packed ARGB color value
  • degrees: Degrees to rotate the hue (positive = clockwise, negative = counter-clockwise)
  • result: Hue-rotated ARGB color value

SATURATE (alias: ColorSaturate)

Description: Increases the saturation of a color in HSL space by the specified amount. The result is clamped to the valid range.

Parameters:

  • color: Packed ARGB color value
  • amount: Amount to add to saturation (0–1)
  • result: More saturated ARGB color value

TOLAB (alias: ColorToLab)

Description: Converts a packed ARGB color to CIE L*a*b* components (D65 illuminant). Returns a list [L, a, b] where L is lightness (0–100), a and b are color-opponent axes (approx. −128–128).

Parameters:

  • color: Packed ARGB color value
  • result: List [L, a, b]

TOLCH (alias: ColorToLCH)

Description: Converts a packed ARGB color to CIE LCH components (cylindrical form of L*a*b*). Returns a list [L, C, H] where L is lightness (0–100), C is chroma (≥0), H is hue angle in degrees (0–360).

Parameters:

  • color: Packed ARGB color value
  • result: List [L, C, H]

TOHSL (alias: ColorToHSL)

Description: Converts a packed ARGB color to HSL components. Returns a list [H, S, L] where H is hue in degrees (0–360), S is saturation (0–1), and L is lightness (0–1).

Parameters:

  • color: Packed ARGB color value
  • result: List [H, S, L]

TOHSV (alias: ColorToHSV)

Description: Converts a packed ARGB color to HSV components. Returns a list [H, S, V] where H is hue in degrees (0–360), S is saturation (0–1), and V is value/brightness (0–1).

Parameters:

  • color: Packed ARGB color value
  • result: List [H, S, V]

TOOKLAB (alias: ColorToOKLab)

Description: Converts a packed ARGB color to OKLab components (Björn Ottosson, 2020). Returns a list [L, a, b] where L is perceptual lightness (0–1), a and b are color-opponent axes (approx. −0.5–0.5).

Parameters:

  • color: Packed ARGB color value
  • result: List [L, a, b]

TOOKLCH (alias: ColorToOKLCH)

Description: Converts a packed ARGB color to OKLCH components (cylindrical form of OKLab). Returns a list [L, C, H] where L is perceptual lightness (0–1), C is chroma (≥0), H is hue angle in degrees (0–360).

Parameters:

  • color: Packed ARGB color value
  • result: List [L, C, H]

Last updated: 2026-04-13