Composite formatting Version 6 (Java)

Action group: Text


Description

Replaces one or more format elements in a string with a string representation of the specified object.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Composite format stringA string in which places for text substitution are denoted as {x}, where x is the ordinal number of the object in the collection.Robin.String
Yes
Object collection to formatA collection of objects, the textual representation of which will replace symbols of the form {x} in the specified string in accordance with their ordinal numbers. Numbering starts from 0.Robin.Collection
Yes
Results
ResultString variable containing the result of substitution of the specified objectsRobin.String

Special conditions of use

If the formatting elements in a string do not have a corresponding numbered element in the object collection, an error will occur.

Example of use

Task

There is a variable "Collection" with values:

0:Greek, 1: river, 2:cancer, 3: river.

Substitute the elements of the collection into the text: driving ? through ?, sees ? in ? ?

Solution

Use the "Composite formatting", "Show message" actions.

Implementation

  1. Create a string type variable "Text" where the "Composite formatting" action result will be written into.
  2. Move the "Composite formatting" action to the workspace and set its parameters.

  3. Move the "Show message" action to the workspace and set its parameters.
  4. Click "Start" in the top panel to start the robot.

Result

The formatted text was displayed in the dialogue window.

  • Нет меток