This post is machine-translated. The original post in german language can be found here.

Split a string with fixed separators

The following snippets are meant to show how to extract the individual elements from a string with fixed separators.

Variant 1: Convert the string to a container using str2con()

static void Job1(Args _args)
    str paramAsStr = "Wert1@@Wert2@@Wert3";
    container paramAsCon;
    int i;

    paramAsCon = str2con(paramAsStr, "@@");
    for (i=1;i<=conLen(paramAsCon);i++)
        info(conPeek(paramAsCon, i));    

Variant 2: Convert the string to a list using strSplit()

static void Job1(Args _args)
    str paramAsStr = "Value 1|Value 2|Value 3";
    List paramAsList;
    ListEnumerator le;

    paramAsList = strSplit(paramAsStr, "|");
    le = paramAsList.getEnumerator();


These post applies to following version:
Dynamics AX 2012

Add comment


Posts of the actual month
Februar 2019
© 2006-2019 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.