Skip to main content

1E SDK

Utilities.SplitLines

Module

Utilities

Method

SplitLines

Library

Core

Action

Convert a delimited fragment of text into multiple rows.

Parameters

Text (string): The text value to be converted into multiple rows.

Delimiter (string; optional, default: new line): The value present in Text which should be treated as the separator between rows. If Delimiter is not passed, or is passed as empty, then the delimiter is assumed to be a new-line sequence.

RemoveEmptyEntries (boolean; optional, default: false): If set to true, discards any rows which are empty.

Return values

For each occurrence of Delimiter within Text:

  • Output (string): The text that occurs between the previous delimiter (or the start of the text) and the next delimiter (or the end of the text)

Example

Take a string in CSV format and split that string into multiple rows based on a comma delimiter:

@c = SELECT "Red,Yellow,Blue,Black,White,Green" AS Colors;
@c = Utilities.SplitLines(Text: @c.Colors, Delimiter: ",");

Platforms

  • Windows

  • Linux

  • MacOS

Notes

The Delimiter parameter does not have to be a single character; it can be any sequence of text. For example, you could use a delimiter of "<li>" to help split HTML list items into individual rows.

If you omit the Delimiter parameter to split the text based on new-lines, the Agent will interpret recognized combinations of carriage-return and line-feed characters as a new-line.

Line numbers are not returned, therefore you must use the built-in SQLite autoincremented key rowid if you need to perform operations on the Output. For example the below code will return the last inserted row "Green" whereas max(Output) would return "Yellow".

select Output from @c order by rowid desc limit 1;