Write Delimited Texts in Text File
Verb: textWriteDelimited
Available from: <Standard>
Writes a list of texts separated by a delimiter to a text file.
Syntax
textWriteDelimited --texts(List<String>) --delimiter(TextDelimiterOption) --characters(String) --lengths(List<Numeric>) --file(TextFileWriter)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--texts | Texts | Required | List<Text> | Texts used for writing to the file, separated by the chosen separator. |
--delimiter | Delimiter type | Required | TextDelimiterOption | Option for selecting the delimiter type used. The available delimiters are:
|
--characters | Separator | Only whenDelimiter type is ByCharacters | Text | Character used as a separator in the text between each text list element. |
--lengths | Lengths | Only whenDelimiter type is ByLengths | List<Number>, Text | Lengths of characters of each part of the final text. They might be expressed as a list of numbers or a sequence with numbers separated by commas "1,2,3". |
--file | Text writer | Required | Text File Writer | Variable that holds the opened text file. |
Example
Writes a list of texts, separated by a character delimiter, to an open text file for writing. The Open Text File for Writing command is used to open the file and the Write Delimited Texts in Text File command is used to write.
defVar --name textsList --type List --innertype String --value "[IBM,Automation,RPA,RDA]"
defVar --name filePath --type String
defVar --name textWriter --type TextFileWriter
getSpecialFolder --folder "Desktop" filePath=value
// Open the file informed for reading.
openTextWriter --mode "OpenOrCreate" --autoflush --share "Write" --path "${filePath}\\textFile.txt" --encoding "Default" textWriter=value
// Write the entered text list into the open file, separated by the delimiter "-".
textWriteDelimited --texts ${textsList} --delimiter "ByCharacters" --characters "-" --file ${textWriter}
// The example returns the following result within the file:
//IBM-Automation-RPA-RDA