$(format)
Description
This built-in function provides textual formatting of various common data type.
Available Functions
$(format|base64decode|text)
base64 decode text.
$(format|base64encode|text)
base64 encode text.
Example
Script:
_01.png)
Output:
_02.png)
$(format|custom|text|format)
Customizable way to reformat text via the specified format. The format parameter contains the back tick (`)
not single quotes (‘) to represent each character in text, and all other characters as formatting characters.
For example,
$(format|custom|ABC|`-`-`)would renderA-B-C$(format|custom|1234567890|(```) ```-````)would render(123) 456-7890$(format|custom|1234567890|```-````)would render123-4567$(format|custom|1234567890|```-```-````)would render123-456-7890
Note that any unused characters will be omitted.
Example
Script:
_03.png)
Output:
_04.png)
$(format|dollar|text)
Render only the numeric characters within text as a dollar amount.
$(format|dollar|58.396) would render $58.40 - note the applied rounding.
Example
Script:
_05.png)
Output:
_06.png)
$(format|fileURI|text)
Render text into a fully qualified file path using the file:// URI scheme. Th assumption here is that text
resolves to a valid local file or path. If not, text will be appended with the fully qualified path of the current
project diretory. This function is particularly useful when it is necessary to create a URL for a local file for the
purpose of hypertext-based content rendering (such as HTML or XML).
Example
$(format|fileURI|C:\temp\myfile.txt)will be rendered asfile:///C:/temp/myfile.txt.$(format|fileURI|\\network_drive\dir1\my documents\june 20202 reports.txt)will be rendered asfile:////network_drive/dir1/my%20documents/june%202020%20reports.txt.$(format|fileURI|non_exisistent)will be rendered asfile:///Users/user1/projects/MyProject/non_existent. Assuming that there is no file or directory named asnon_existentand the current project directory is/Users/user1/projects/MyProject.
$(format|integer|text)
Render only the numeric characters within text, including the negative sign (if found). Supposed text is specified
as 90abv2a. Then $(format|integer|text) would render 902.
Example
Script:
_07.png)
Output:
_08.png)
$(format|left|text|length)
Render only the left-most portion of text, for the specified length.
One can consider this built-in function as a way to truncate text and retain its left-most characters, up to the
specified length.
Note that if the specified text is less than the specified length, then the entire text will be rendered. If the
specified length is less than 1, then this function will render an empty text instead.
Example
Script:
_09.png)
Output:
_10.png)
$(format|lower|text)
Convert text to its lowercase equivalent.
Example
Script:
_11.png)
Output:
_12.png)
$(format|mask|text|start|end|maskChar)
Mask certain part of text with maskChar. The start and end parameter specified where the masking should be applied.
For example,
$(format|mask|5432109876|0|5|x)would renderxxxxx9876$(format|mask|Howdy folks!|5|11| )would renderHowdy- Note that character position is zero-based and if the positions specified is outside the range of the specified
text, thentextwill be rendered as is.
Example
Script:
_13.png)
Output:
_14.png)
$(format|number|text|format)
Render only the numeric characters within text, including the negative sign and decimal point (if found), using the
specified format. Supposed text is specified as 90ab.v2a. Then
$(format|number|${text}|#.##)would render90.2(#represents “minimum digit”)$(format|number|${text}|000.00)would render090.20(0represents “at least digit”)
For more details on numeric format and how to specify them, consult Decimal Format or I18N Decimal Format.
Example
Script:
_15.png)
Output:
_16.png)
$(format|percent|text)
Render only the numeric characters within text as percentage. Note that this function considers the value 1.0 as 100%.
Hence $(format|percent|0.52448) would render 52.45%.
Example
Script:
_17.png)
Output:
_18.png)
$(format|phone|text)
Render text as a phone number, with support for various length.
- If text is less than 7 characters long, it will be rendered as is.
- If text is 7 characters long, then it will be formatted as xxx-xxxx.
- If text is 10 characters long, then it will be formatted as (xxx)xxx-xxxx.
- If text is 11 characters long, then it will be formatted as x(xxx)xxx-xxxx.
- Otherwise, text will be rendered as x...x(xxx)xxx-xxxx, depending on the number of characters found. Note
that in this case, the formatting starts from right to left.
- For more flexible formatting option, see $(format|custom|text|format).
Example
Script:
_19.png)
Output:
_20.png)
$(format|right|text|length)
Render only the right-most portion of text, for the specified length.
One can consider this built-in function as a way to truncate (from the left) text and retain its right-most
characters, up to the specified length.
Note that if the specified text is less than the specified length, then the entire text will be rendered. If the
specified length is less than 1, then this function will render an empty text instead.
Example
Script:
_21.png)
Output:
_22.png)
$(format|ssn|text)
Render text as a Social Security Number, in the format of xxx-xx-xxxx. Note that exactly 9 characters are required
for the formatting to be rendered, otherwise the text will be rendered as is.
For more flexible formatting option, see $(format|custom|text|format).
Example
Script:
_23.png)
Output:
_24.png)
$(format|strip|text|omit)
Render text without any of the characters specified through omit. This is a useful/easy way to remove spaces, tabs,
or punctuations.
Example
Script:
_25.png)
Output:
_26.png)
$(format|titlecase|text)
Convert text to title case - that is, the first letter of each word is converted to uppercase, while the rest to lowercase.
Example
Script:
_27.png)
Output:
_28.png)
$(format|upper|text)
Convert text to its UPPERCASE equivalent.
Example
Script:
_29.png)
Output:
_30.png)
$(format|urldecode|text)
Perform URL Encoding
on text so that it is more readable or usable for non-HTTP related processing. Generally speaking, successive call
to this function should have not varying result – such call is likely
idempotent.
$(format|urlencode|text)
Perform URL Encoding
on text so that it may be suitable as part of an URL (or URL query). Note that Nexial does not check to if text
might have already being encoded. Hence successive calls to this function might result in undesired effect.
Example
Script:
_31.png)
Output:
_32.png)