LC0085 - StefanMaron/BusinessCentral.LinterCop GitHub Wiki

Use the (CR)LFSeparator from the Type Helper codeunit.

The rule will raise a diagnostic whenever a Char or Text[1] variable is assigned line-feed (10) value directly, suggesting the use of the Type Helper codeunit from the Base Application instead.

Avoid manually creating helper methods or directly assigning character values (e.g., Char := 10 or Text[1] := 10) to define line-feed (LF) or carriage return (CR) separators. Instead, use the LFSeparator and CRLFSeparator constants provided by the Type Helper codeunit.

Source: https://github.com/StefanMaron/MSDyn365BC.Sandbox.Code.History/blob/9d5ee84497176ed61da1b4199725b688a1dd2939/BaseApp/Source/Base%20Application/System/Utilities/TypeHelper.Codeunit.al#L595

Example

procedure MyProcedure()
var
    myText: Text;
begin
    myText[1] := 10; // Use the (CR)LFSeparator from the "Type Helper" codeunit from the Base Application to define a line feed (LF) or carriage return (CR) variable.
end;
procedure MyProcedure()
var
    TypeHelper: Codeunit "Type Helper";
    LineSeparator: Text;
begin
    LineSeparator := TypeHelper.LFSeparator();

    while MyCondition do
        TextBuilder.Append(TypeHelper.ReadAsTextWithSeparator(InStream, LineSeparator));
end;