web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Split text by new lines

(0) ShareShare
ReportReport
Posted on by 61

Hello guys,

I'm trying split a CSV-text into the array of separate lines. I have a Text array, where the CSV-text is stored, it looks like following:

"Header1, Header2, Header3

Value1, Value2, Value3

Value4, Value5, Value6"

In order to split the text I tried following constructions:

Text.Split('\n');

Text.Split('\\n');

Text.Split('\r\n');

Neither of the above mentioned versions work.

Maybe someone could advise what is the proper way to split text by new lines?

I have the same question (0)
  • Verified answer
    Alok.kulshreshtha Profile Picture
    934 on at

    Hi

    Try below

    CRLF[1] := 13; (if 13 not work than try 10)

    Value1, Value2, Value3 + CRLF[1] + Value4, Value5, Value6

    Regards,

    Alok Kulshreshtha

    Please Verify my answer if you find my post helpful.

  • Johny Be Good Profile Picture
    61 on at

    Hi Alok!

    Thank you for your reply!

    I tried your advice, but it didn't work, maybe I did something wrong.

    I used following file as an example - people.sc.fsu.edu/.../addresses.csv

    ...

    Client.Get('people.sc.fsu.edu/.../addresses.csv', Response);

    Response.Content.ReadAs(Body);

    Exit(Utils.Parse(Body));

    ...

    codeunit 50100 Utils

    {

       procedure Parse(CSV: Text): List of [Text];

       var

           result: List of [Text];

           CRLF: Integer;

       begin

           CRLF := 13;

           result := CSVText.Split(Format(CRLF));

           Exit(result);

       end;

    }

    Also I tried 10 instead of 13, but it didn't work either

  • Johny Be Good Profile Picture
    61 on at

    Ah, yeah...

    I used the wrong type for the new line code

    Here is working version:

       procedure Parse(CSV: Text): List of [Text];

       var

           result: List of [Text];

           CRLF: Char;

       begin

           CRLF := 10;

           result := CSV.Split(CRLF);

           Exit(result);

       end;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,086 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,290 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,218

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans