Transform Formatters

Version 24.2.9039


Transform Formatters


concat([newString])

Concatenates the value piped into the formatter with the parameter passed to the formatter

  • newString: The string to append to the attribute.

insert(integer_index, string)

Inserts the specified string at the specified index.

  • index: The zero-based index of the position in the original value where the new string should be inserted.
  • string: The string to insert into the original value.

regexreplace(pattern, newvalue[, startindex])

Searches the input string for the regex pattern specified by pattern and replaces each occurrence with newvalue.

If the startindex parameter is provided, the search begins at this position in the string (in other words, the formatter ignores instances of the pattern that occur prior to startindex).

Example

<arc:set attr="myString" value="The cost of the item is $12.98." />
<arc:set attr="decimalPattern" value="\[0-9\]+\.?\[0-9\]*" />
<arc:set attr="updatedListing" value="[myString | regexreplace([decimalPattern],'10.99')]" />
<!-- updatedListing has the value: The cost of the item is $10.99 -->

remove(integer_index[, integer_count])

Deletes characters from the attribute value, beginning at the zero-based index specified by the first parameter.

  • index: The position at which to begin deleting the characters.
  • count: The optional number of characters to delete. If not provided, all characters starting from the specified index are deleted.

replace(oldvalue, newvalue[, ishex])

Searches the input string for each occurrence of oldvalue, removes it, and replaces it with newvalue.

The ishex parameter indicates if the oldvalue parameter is a hex representation of a character to replace (the default is false).

Example

<arc:set attr="myString" value="I hope you have a wonderful day." />
<arc:set attr="honestString" value="[myString | replace('you', 'I')]" />
<!-- honestString holds the value: I hope I have a wonderful day. -->

rsplit(delimiter, integer_index)

Splits the string represented by the attribute value into tokens delimited with the first parameter and returns the token at the index specified by the second parameter. It counts from the right.

  • delimiter: The string used as a separator for splitting the string into tokens.
  • index: The index of the token requested where the first token is at index 1.

split(delimiter, indextoreturn)

Splits the input string at each occurrence of the delimiter into a set of substrings, then returns the string at the given index.

If indextoreturn is provided, the set of substrings is indexed to return one of the substrings (for example, passing 1 as the indextoreturn returns the first substring that resulted from the split).

Example

<arc:set attr="myName" value="Walter White" />
<arc:set attr="firstName" value="[myName | split(' ',1)]" />
<!-- firstName contains the value: Walter -->

striphtml()

Returns the string with any HTML markup removed.

substring(index[, length])

Returns a substring of the input string value, starting at the index value and ending length characters later. If length is not provided, the substring ends at the end of the original string.

Example

<!-- parse out the characters before the first comma, combining substring() with find() -->

<arc:set attr="myString" value="Luke, I am your father". />
<arc:set attr="commaPosition" value="[myString | find(',')]" />
<arc:set attr="introClause" value="[myString | substring(0, [commaPosition])]" />
<!-- introClause has the value: Luke -->

toalpha()

Returns only the letters in a string.

toalphanum()

Returns only the alphanumeric characters in a string.

truncate(integer_count)

Truncates the attribute value to the number of characters specified by the parameter.

  • count: The number of characters in the resulting string.