# A2uiBasicCatalogV1.Functions

Artifact: [androidx.a2ui.compose:compose-ui](https://developer.android.com/jetpack/androidx/releases/a2ui-compose) [View Source](https://cs.android.com/search?q=file:androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.kt+class:androidx.a2ui.compose.ui.catalog.A2uiBasicCatalogV1.Functions) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)


```
interface A2uiBasicCatalogV1.Functions
```

<br />

*** ** * ** ***

The functions of the A2UI Basic Catalog V1, with one method for each function in the specification except the logical functions `and`, `or`, and `not`, which the catalog implements itself.

The catalog provides the definition of each function and parses the arguments of each call, so implementations only implement the behavior of the functions. Each method receives the parsed arguments and the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call. Implementations can throw an `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiException` to report an error to the agent.

Implement `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#openUrl(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)`, and override other methods to customize individual functions. Every method except `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#openUrl(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` has a default implementation, which an override can call with `super`, e.g., to add a check before it.

The `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1#Functions(android.content.Context,androidx.a2ui.model.catalog.functions.A2uiLocaleProvider)` factory function creates implementations of all methods, including `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#openUrl(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)`. To customize individual functions of an existing implementation, such as the one that this factory function creates, delegate to it and override the methods of those functions, e.g., `object : A2uiBasicCatalogV1.Functions by A2uiBasicCatalogV1.Functions(context) { ... }`. In such an object, `super` calls the default implementations of this interface rather than the methods of the delegate. To reuse the implementations of the delegate, call its methods instead.

## Summary

| ### Public functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#email(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext)` Implements the A2UI `"email"` function, which checks that a string is a valid email address. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatCurrency(kotlin.Double,kotlin.String,kotlin.Int,kotlin.Boolean,androidx.a2ui.model.protocol.A2uiExecutionContext)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, currency: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, decimals: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, grouping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"formatCurrency"` function, which formats an amount of money for display. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatDate(kotlin.Long,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)( epochMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"formatDate"` function, which formats a date for display. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatNumber(kotlin.Double,kotlin.Int,kotlin.Boolean,androidx.a2ui.model.protocol.A2uiExecutionContext)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, decimals: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, grouping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"formatNumber"` function, which formats a number for display. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatString(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext)` Implements the A2UI `"formatString"` function, which interpolates expressions in a string. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#length(kotlin.String,kotlin.Int,kotlin.Int,androidx.a2ui.model.protocol.A2uiExecutionContext)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"length"` function, which checks the length of a string. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#numeric(kotlin.Double,kotlin.Double,kotlin.Double,androidx.a2ui.model.protocol.A2uiExecutionContext)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"numeric"` function, which checks that a number is within a range. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#openUrl(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)(url: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext)` Implements the A2UI `"openUrl"` function, which opens a URL in a browser or another app. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html, zero: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, one: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, two: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, few: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, many: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"pluralize"` function, which selects a string by the plural category of a number. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#regex(kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, pattern: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext )` Implements the A2UI `"regex"` function, which checks that a value matches a regular expression. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#required(kotlin.Any,androidx.a2ui.model.protocol.A2uiExecutionContext)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext)` Implements the A2UI `"required"` function, which checks that a value is present and not empty. |

## Public functions

### email

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun email(value: String, executionContext: A2uiExecutionContext): Boolean
```

Implements the A2UI `"email"` function, which checks that a string is a valid email address.

The default implementation matches values against a common email address pattern.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the string to check |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#email(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` is a valid email address |

### formatCurrency

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun formatCurrency(
    value: Double,
    currency: String,
    decimals: Int?,
    grouping: Boolean,
    executionContext: A2uiExecutionContext
): String
```

Implements the A2UI `"formatCurrency"` function, which formats an amount of money for display.

The default implementation formats amounts with `https://developer.android.com/reference/java/text/NumberFormat.html` in the default locale.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the monetary amount to format |
| `currency: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the ISO 4217 currency code, e.g., `USD` |
| `decimals: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?` | the number of decimal places to show, or `null` for the default precision of `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatCurrency(kotlin.Double,kotlin.String,kotlin.Int,kotlin.Boolean,androidx.a2ui.model.protocol.A2uiExecutionContext)` |
| `grouping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether to use locale-specific grouping separators, e.g., `1,000` |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the formatted amount |

### formatDate

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun formatDate(
    epochMillis: Long,
    format: String,
    executionContext: A2uiExecutionContext
): String
```

Implements the A2UI `"formatDate"` function, which formats a date for display.

The default implementation formats dates in UTC with `https://developer.android.com/reference/java/text/SimpleDateFormat.html` in the default locale.

| Parameters |
|---|---|
| `epochMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the date to format, in milliseconds since the Unix epoch |
| `format: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the Unicode TR35 date pattern, e.g., `MMM dd, yyyy` |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the formatted date |

### formatNumber

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun formatNumber(
    value: Double,
    decimals: Int?,
    grouping: Boolean,
    executionContext: A2uiExecutionContext
): String
```

Implements the A2UI `"formatNumber"` function, which formats a number for display.

The default implementation formats numbers with `https://developer.android.com/reference/java/text/NumberFormat.html` in the default locale.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the number to format |
| `decimals: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?` | the number of decimal places to show, or `null` for the default precision |
| `grouping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether to use locale-specific grouping separators, e.g., `1,000` |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the formatted number |

### formatString

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun formatString(value: String, executionContext: A2uiExecutionContext): String
```

Implements the A2UI `"formatString"` function, which interpolates expressions in a string.

The default implementation replaces the `${expression}` placeholders in `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatString(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` with the results that `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#formatString(kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` evaluates, and handles escape sequences as the specification defines.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the string to format, which can contain data model paths and function calls in `${expression}` placeholders |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call, which evaluates the expressions |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the formatted string |

### length

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun length(
    value: String,
    min: Int,
    max: Int,
    executionContext: A2uiExecutionContext
): Boolean
```

Implements the A2UI `"length"` function, which checks the length of a string.

The default implementation measures values with `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/length.html`, including both bounds.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the string to check |
| `min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the minimum allowed length, which is 0 if the call doesn't specify one |
| `max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the maximum allowed length, which is `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/-companion/-m-a-x_-v-a-l-u-e.html` if the call doesn't specify one |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the length of `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#length(kotlin.String,kotlin.Int,kotlin.Int,androidx.a2ui.model.protocol.A2uiExecutionContext)` is between `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#length(kotlin.String,kotlin.Int,kotlin.Int,androidx.a2ui.model.protocol.A2uiExecutionContext)` and `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#length(kotlin.String,kotlin.Int,kotlin.Int,androidx.a2ui.model.protocol.A2uiExecutionContext)` |

### numeric

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun numeric(
    value: Double,
    min: Double,
    max: Double,
    executionContext: A2uiExecutionContext
): Boolean
```

Implements the A2UI `"numeric"` function, which checks that a number is within a range.

The default implementation includes both bounds.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the number to check |
| `min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the minimum allowed value, which is `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/-companion/-n-e-g-a-t-i-v-e_-i-n-f-i-n-i-t-y.html` if the call doesn't specify one |
| `max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the maximum allowed value, which is `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/-companion/-p-o-s-i-t-i-v-e_-i-n-f-i-n-i-t-y.html` if the call doesn't specify one |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#numeric(kotlin.Double,kotlin.Double,kotlin.Double,androidx.a2ui.model.protocol.A2uiExecutionContext)` is between `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#numeric(kotlin.Double,kotlin.Double,kotlin.Double,androidx.a2ui.model.protocol.A2uiExecutionContext)` and `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#numeric(kotlin.Double,kotlin.Double,kotlin.Double,androidx.a2ui.model.protocol.A2uiExecutionContext)` |

### openUrl

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
fun openUrl(url: String, executionContext: A2uiExecutionContext): Unit
```

Implements the A2UI `"openUrl"` function, which opens a URL in a browser or another app.

This method has no default implementation, because how to open a URL depends on the app. The `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1#Functions(android.content.Context,androidx.a2ui.model.catalog.functions.A2uiLocaleProvider)` factory function creates an implementation that opens URLs with an `https://developer.android.com/reference/android/content/Intent.html#ACTION_VIEW` intent.

| Parameters |
|---|---|
| `url: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the non-empty URL to open |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

### pluralize

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun pluralize(
    value: Double,
    zero: String?,
    one: String?,
    two: String?,
    few: String?,
    many: String?,
    other: String,
    executionContext: A2uiExecutionContext
): String
```

Implements the A2UI `"pluralize"` function, which selects a string by the plural category of a number.

The default implementation selects strings with the ICU plural rules of the default locale.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | the number that determines the plural category |
| `zero: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the string for the `zero` category, or `null` to use `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |
| `one: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the string for the `one` category, or `null` to use `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |
| `two: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the string for the `two` category, or `null` to use `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |
| `few: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the string for the `few` category, or `null` to use `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |
| `many: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the string for the `many` category, or `null` to use `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |
| `other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the string for all other categories |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the string for the plural category of `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#pluralize(kotlin.Double,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |

### regex

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun regex(
    value: String,
    pattern: String,
    executionContext: A2uiExecutionContext
): Boolean
```

Implements the A2UI `"regex"` function, which checks that a value matches a regular expression.

The default implementation matches values with `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.text/-regex/index.html`.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the string to check |
| `pattern: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the regular expression that `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#regex(kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` must match entirely |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#regex(kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` matches `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#regex(kotlin.String,kotlin.String,androidx.a2ui.model.protocol.A2uiExecutionContext)` |

### required

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui-compose#1.0.0-alpha02)

```
open fun required(value: Any?, executionContext: A2uiExecutionContext): Boolean
```

Implements the A2UI `"required"` function, which checks that a value is present and not empty.

Unlike other functions, this function is called when its `value` argument can't be resolved, e.g., when it binds to a missing data model path. The default implementation treats `null` and empty strings, collections, maps, and arrays as missing.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | the value to check, or `null` if it is missing or can't be resolved |
| `executionContext: https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` | the `https://developer.android.com/reference/kotlin/androidx/a2ui/model/protocol/A2uiExecutionContext` of the call |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Functions#required(kotlin.Any,androidx.a2ui.model.protocol.A2uiExecutionContext)` is present and not empty |