Convert the collection to the string
Collection group, Arrays subgroup
Description
The action converts the collection elements to one string.
Action icon
Parameters
Input parameters
- The "Collection" field - the collection whose elements will be converted to a string.
- The "Separator" field - the character or characters that will separate the elements in the string.
Output parameters
- "Result". Description: the string with converted elements from the collection. Data type - Robin.String.
Settings
Property | Description | Type | Filling example | Mandatory field |
---|---|---|---|---|
Parameters | ||||
Collection | The collection whose elements will be converted to a string. | Robin.Collection | Yes | |
Separator | The character or characters that will separate the elements in the string. | Robin.String | No | |
Results | ||||
Result | The string with joined elements from the collection. | Robin.String |
Special conditions of use
- The action can only convert collection items with the data types "String" or "Number".
- If there are no string/numeric elements in the collection, the action will return an empty string.
- If the collection contains elements of other types besides string/numeric elements, the action will convert only string/numeric elements.
- The user can enter character\characters that will separate the elements in the string. Example: the elements of the collection are: "1", "2", "3", "а". Separator: "|". Result: string "1|2|3|a".
- If the user does not set a separator, the elements in the string will go one after the other. Example: The elements of a collection are: "1", "2", "3", "а". Result: string "123a".
- If there is one string/numeric element in the collection, the action will return a string with one element. In this case, the set separator will not be taken into account.
- Output the collection of whole numbers without zero (i.e., not "1.0" but "1").
Example of use
Task 1
Conversion without the separator.
Solution
- Set the "Convert the collection to the string" items action to the workspace.
- Set the parameters correctly: in the "Collection" parameter set the collection with several string or numeric elements, set the "Separator" as a character/characters.
- Run the robot.
Implementation
- Set the "Convert the collection elements" action to the workspace.
- Set the parameters correctly: in the "Collection" field set the collection with several string or numeric elements, do not set the "Separator".
- Run the robot.
Result
The action returned the string with string and numeric collection elements that were separated with the set character/characters.
Task 2:
Conversion with the separator
Solution
- Set the "Convert the collection elements" action to the workspace.
- Set the parameters correctly: in the "Collection" parameter set the collection with several string or numeric elements, set the "Separator" as a character/characters.
- Run the robot.
Implementation
- Repeat steps 1-3 of Task 1.
- Set the parameters correctly: in the "Collection" field set the collection with several string or numeric elements, do not set the "Separator".
- Run the robot.
Result
The action returned a string of consecutive string and numeric elements of the set collection.
Task 3
Conversion of the collection without string/numeric elements.
Solution
- Set the "Convert the collection elements" action to the workspace.
- Set the parameters correctly: in the "Collection" parameter set the collection without string or numeric elements, set the "Separator" as a character/characters.
- Run the robot.
Implementation
- Repeat steps 1-3 of Task 1.
- In the "Collection" parameters don't set the collection type. Leave it empty.
Result
The action returned an empty string.
Task 4
Conversion of the collection with whole numbers
- Set the "Convert the collection elements" action to the workspace.
- Set the parameters correctly: in the "Collection" parameter set the collection with whole numbers.
- Run the robot.
Implementation
- Repeat steps 1-3 of Task 1.
- Set the elements in the collection as whole numbers, with the decimal place as zero.
Result
The action returned a string of consecutive whole numbers. The zero after the whole numbers is not written.
Collection elements: "10.0", "11.0". Result: "1011".
Обзор
Инструменты контента