Text - Pad
Declaration
<AMTEXT ACTIVITY="pad_text" TEXT="text" RESULTVARIABLE="text" ACTION="text (options)" LENGTH="text" PADTYPE="text (options)" AMOUNT="text" PADDINGCHAR="text" />
Overview
Adds a single character to the beginning or end of an existing text value and populates a variable with the new value.
Practical usage
Used as a text manipulation tool to insert new text into the beginning or end of an existing text value. For example, you can pad the end of the target text with a single space so newly added text does not touch them.
Parameters
General
| Property | Type | Required | Default | Markup | Description |
|---|---|---|---|---|---|
| Text to pad | Text | Yes | (Empty) | TEXT="My Name is Joe" | The target text to be padded. As with every text parameter, if the data you want to enter is contained in a variable, enter the variable name surrounded by percent signs (%) to resolve it to its contents at runtime (for example, %VarName%). |
| Action | Text (options) | No | pad_beginning |
|
The
location where the padding is applied. The available options
are:
|
| Character to pad with | Text | Yes | (Empty) | PADDINGCHAR="a" | The character to use as the padding item. |
| Padding type | Text (options) | No | length | PADTYPE="insert_position" |
The padding type to apply. The available options are:
|
|
Length of text |
Number |
Yes, if Padding type is set to Until text is specific length | (Empty) | LENGTH="10" | The total length of the text that the padding ends. This parameter is available only if the Padding type parameter is set to Until text is specific length. |
| Number of times to add | Number | Yes, if Padding type is set to A specified number of times | (Empty) | AMOUNT="5" | The total amount of times that the padding is repeated. This parameter is available only if the Padding type parameter is set to A specified number of times. |
| Populate variable with result | Text | Yes | (Empty) | RESULTVARIABLE="varname" | The name of an existing variable to receive the new value after character insertion is performed. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
The following sample task displays a message, showing text before and after a Text - Pad activity is used:
<AMVARIABLE NAME="varname" VALUE="hello" />
<AMSHOWDIALOG WINDOWTITLE="Text before Pad activity">%varname%</AMSHOWDIALOG>
<AMTEXT ACTIVITY="pad_text" TEXT="%varname%" RESULTVARIABLE="varname" ACTION="pad_end" LENGTH="" PADDINGCHAR="_" />
<AMSHOWDIALOG WINDOWTITLE="Text after Pad activity inserts a "_" character at the end of the original text.">%varname%</AMSHOWDIALOG>