Use the (CR)LFSeparator from the Type Helper codeunit

Properties
AC0025 Info Design Code Fix Ignore Obsolete

When AL code needs a line feed character — for multiline messages, CSV formatting, or splitting text — developers commonly assign the ASCII value directly: LineFeed := 10 or MyText[1] := 10. The magic number works, but says nothing about its purpose. A reader who encounters 10 in an assignment has to know the ASCII table to understand the intent.

The Base Application’s Type Helper codeunit provides LFSeparator() and CRLFSeparator() methods for exactly this purpose.

Example

procedure MyProcedure()
var
    LineFeed: Char;
begin
    LineFeed := 10; // Use the (CR)LFSeparator from the Type Helper codeunit [AC0025]
end;

Replace the magic number with the LFSeparator() method from the “Type Helper” codeunit:

procedure MyProcedure()
var
    TypeHelper: Codeunit "Type Helper";
    LineFeed: Text[1];
begin
    LineFeed := TypeHelper.LFSeparator();
end;

When the diagnostic is reported

  • A Char variable is assigned the integer literal 10.
  • A Text or Code variable at index [1] or [2] is assigned the integer literal 10.

Assignments to index [3] or higher are not flagged.