Whitespace Formatters

Version 24.1.8906


Whitespace Formatters


center(integer_width[, character])

Returns the attribute value centered in a string of width specified by the first parameter. Padding is done using the fillchar specified by the second parameter.

  • width: The total width of the output string.
  • character: The optional character used for padding. If not specified this defaults to a space.

expandtabs([integer_width])

Replaces all tab characters found in the attribute value with spaces. If the tab size specified by the parameter is not given, a default tab size of 8 characters is used.

  • width: The optional tab width, defaults to 8 if not specified.

just(integer_width[, character])

Returns the attribute value left-justified in a string of length specified by the first parameter. Padding is done using the fillchar specified by the second parameter.

  • width: The total width of the output string.
  • character: The optional character used for padding. The default is a space.

ljust(integer_width[, character])

Returns the attribute value left-justified in a string of length specified by the first parameter. Padding is done using the fillchar specified by the second parameter.

  • width: The total width of the output string.
  • character: The optional character used for padding. The default is a space.

nowhitespace()

Removes the white space from the string represented by the attribute value.

rjust(integer_width[, character])

Returns the right-justified attribute value in a string of length specified by the second parameter. Padding is done using the fillchar specified by the first parameter.

  • width: The total width of the output string.
  • character: The optional character used for padding, if not specified this defaults to a space.

trim()

Removes leading and trailing whitespace from the input string.

Example

<arc:set attr="uglyString" value="    here is some data.  " />
<arc:set attr="prettyString" value="[uglyString | trim()]" />

trimend()

Trims trailing white space from an attribute.

trimstart()

Trims leading white space from an attribute.

wordwrap([integer_width][, break][, cut][, wrapexp])

Wraps a string to a certain width while respecting word boundaries.

  • width: The maximum line length after wrapping the string.
  • break: The character(s) used to break the string; the default value is CRLF (e.g. ‘\r\n’).
  • cut: The optional boolean value that specifies whether to wrap the string at or before the specified width. Default is false.
  • wrapexp: A regex expression representing the characters to replace when “breaking” the string; the default is the ‘space’ character (this default is intended for strings consisting of words separated by spaces). To break a string unconditionally without respecting word boundaries, set this paramater to empty string: ‘’