> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Array Formatters

> Formatters that operate on array attributes in ArcScript, returning aggregated or searched values across multiple array elements.

export const siteNameShort = "Arc";

The following formatters expect an array attribute as input. An array attribute is a single attribute on an item that has multiple values assigned to it. Array attributes in {siteNameShort}Script are denoted by the pound sign (`#`) at the end of the attribute (for example `tmp.myarrayitem#`). See [Selecting Attribute Values](../operations/operations) for more information.

<Note>
  * The `#` symbol is not needed when you are passing in the array attribute to any of these formatters.
  * The square brackets around the optional parameters of some formatters are not required. They are there to denote that the parameter is optional.
</Note>

## arrayaverage(\[integer\_rounding\_mode]\[decimal\_places])

Returns the average of the attribute array elements.

* **rounding\_mode**: Specifies the rounding behavior for numerical operations capable of discarding precision. Accepted values are: `ToEven`, `AwayFromZero`, `ToZero`, `ToNegativeInfinity`, `ToPositiveInfinity`. The default rounding strategy used is based on your operating system. .NET uses <a href="https://learn.microsoft.com/en-us/dotnet/api/system.midpointrounding?view=net-6.0" target="_blank">ToEven</a>, and Java uses <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/RoundingMode.html#HALF_EVEN" target="_blank">Half Even</a>.

You can also specify a global `RoundingMode` environment variable and provide one of the `rounding_mode` values as its value. When you do this, {siteNameShort} uses that rounding mode any time a `rounding_mode` has not been explicitly specified in the formatter. To be more specific, {siteNameShort} checks for values in this order:

1. `rounding_mode` input
2. The `RoundingMode` environment variable
3. The default as determined by the operating system, as described above

## arrayfind(substring)

Returns the index at which the string is found in the attribute array. The index is 1-based.

* **searchstring**: The string to search for in the original value.

## count(substring)

Returns the number of occurrences in the attribute value of a substring specified by the first parameter.

* **substring**: The substring to search for in the attribute value.

## endswith(substring\[, iftrue]\[, iffalse])

Determines whether the attribute value ends with the specified parameter. Returns *true* (or *iftrue*) if the attribute ends with the value, and *false* (or *iffalse*) if not.

* **substring**: The string expected at the end.
* **iftrue**: The optional value returned if the attribute value ends with the parameter value.
* **iffalse**: The optional value returned if the attribute value does not end with the parameter value.

## implode(\[separator])

Implodes multiple values to a string separated by a separator.

* **separator**: The optional separator.

## join(\[separator])

Joins multiple values to a string separated by a separator.

* **separator**: The optional separator.

## match(pattern\[, index]\[, option])

Searches the string represented by the attribute value for an occurrence of the regular expression supplied in the *pattern* parameter.

* **pattern**: The regular expression pattern to match.
* **index**: The optional numbered index of the match to return. The default is `0`.
* **option**: The optional comma-separated list of regular expression options. Some of the commonly used options are IgnoreCase, Multiline, Singleline, and IgnorePatternWhitespace.

## print(\[delim])

Returns a string with all the values of the attribute concatenated using the specified delimiter.

* **delim**: The optional delimiter to separate values with. The default is a comma.
