Details
| ID | ArrayToCSV |
|---|---|
| Language | python |
| From Version | 6.0.0 |
| Docker Image | demisto/python3:3.12.13.10404775 |
| Tags | transformer general |
README
Converts a simple Array into a textual comma separated string
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | transformer, general |
| Cortex XSOAR Version | 6.0.0 |
Inputs
| Argument Name | Description |
|---|---|
| value | An array of strings input |
Outputs
There are no outputs for this script.
Script Examples
Example command
!ArrayToCSV value=`["example","example"]`
Context Example
{}
Human Readable Output
example,example
Example command
!ArrayToCSV value="example,example,example"
Context Example
{}
Human Readable Output
example,example,example
from ArrayToCSV import arr_to_csv_command def test_arr_to_csv_command__array_of_two_values(): """ Given: A list with 2 values When: converting list to a string representing a csv Then: the function will return the string as is (which is a valid csv format) """ arr = ["mock", "mocker"] result = arr_to_csv_command(arr) assert result == "mock,mocker" def test_arr_to_csv_command__array_of_one_value(): """ Given: A list with one value When: converting list to a string representing a csv Then: validate the result is valid csv """ arr = ["mock"] result = arr_to_csv_command(arr) assert result == "mock" def test_arr_to_csv_command__empty_array(): """ Given: An empty list When: converting list to a string representing a csv Then: The result is an empty string (which is a valid csv format) """ arr = "" result = arr_to_csv_command(arr) assert result == ""