Whitespace Formatters
Version 24.2.9039
Version 24.2.9039
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. The default is 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. The default is 8 characters.
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. The default is 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 (for example,
rn
). - cut: The optional boolean value that specifies whether to wrap the string at or before the specified width. The default is
false
. - wrapexp: A regex expression representing the characters to replace when breaking the string. The default is a space (this default is intended for strings consisting of words separated by spaces). To break a string without respecting word boundaries, set this parameter to empty string: ` `