strLine Function [AX 2012]

Updated: December 10, 2009

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Retrieves a single line from a string that spans multiple lines.


str strLine(str string, int count)

Parameter

Description

string

A string that may span multiple lines.

count

The offset of the line to return.

A copied line of the string specified by the string parameter.

The first line of the string has an offset of 0.

You can assign multiple lines to one string by embedding the \n or \r\n characters in the string. Also, you can use the @ character immediately before the opening quotation mark and use the Enter key to spread parts of the string value over multiple lines in the X++ code editor.

static void strLineExample(Args _arg)
{
    str mytxt = "first-line\nsecond-line\nlast-line";
    ;
 
// Prints "second-line".
    print strLine(mytxt,1);
 
// Prints "last-line".
    print strLine(mytxt,2); 
    pause;
}

Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).

Community Additions

ADD
Show: