[SalesForce] Reading Long Text Area field with line breaks

I have long text area field, which has data on each line. I am populating a line then hitting
"Enter" and then populating the next line and hitting "enter" again and so on.

When reading this field from APEX I am splitting the field by \n

rec.My_Long_Text_Area_Field__c.split('\n');

This returns me list of string where each string corresponds to the line in the long text area field.
This way I am successfully able to read each line of the long text area field.

When I looked at the documentation of Long Text Area, below is what I see following:

Note that every time you press Enter within a long text area field, a linebreak and a return character are added to the text."

But based on what I explained in the begining when I press enter, all I get is a \n, newline character.

Why do I see difference in documentation vs what I am doing ?
Is my way of reading Long Text Area field is correct or am I missing something ?

Best Answer

In this instance the documentation is correct. Ultimately they are putting \n\r to represent a "new line". When you split the lines, you are looking at \n. This will cause each line to start with \r and is not impacting the way you are reading the string lines in your code.