Lines.FromText
A text cut into a list of lines.
Group: Binary and lines. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Lines.FromText(text as text, optional quoteStyle as any, optional includeLineSeparators as nullable logical) as list
| Parameter | Type | Description |
|---|---|---|
text | text | The text to cut. |
quoteStyle | any optional | QuoteStyle.Csv keeps a line break inside double quotes as part of the line; QuoteStyle.None breaks at every line break. |
includeLineSeparators | nullable logical optional | true to keep each line's line break at its end. Left out, the line breaks are dropped. |
Returns
list. One text per line.
Remarks
- A line ends at a carriage return and line feed, a line feed alone, or a carriage return alone: files from Windows, Mac and Linux all give clean lines.
Examples
Mixed line breaks
Lines.FromText("Oslo#(cr,lf)Bergen#(lf)Trondheim")
{"Oslo", "Bergen", "Trondheim"}
Keeping the line breaks
Lines.FromText("Oslo#(cr,lf)Bergen#(lf)Trondheim", QuoteStyle.None, true)
{"Oslo#(cr,lf)", "Bergen#(lf)", "Trondheim"}