web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to remove first word from string

(0) ShareShare
ReportReport
Posted on by

How to remove first word from string in AX 2012  run time, 

First can be of any length, requirement is to remove or delete the first word of the string dynamically,

we have string function but haven't found any function that removes/deletes first word from string, (do not want to hard coded words, needs run time),

Please do needful,

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    axk Profile Picture
    925 on at

    You have to find index of first space (" ") - strFind(), and get substring from your string, starting from space index - subStr().

  • Gautam Profile Picture
    3,945 on at

    Hi Akbarpasha,

    you can use something like this:-

    strDel("qwerty",1,1)

    output - werty

    put required string instead of "qwerty".

    Thanks

    Gautam

  • Suggested answer
    Community Member Profile Picture
    on at

       str st = 'A B C D';

       str s;

       container con;

       con = str2con(st, ' ');

       con = conDel(con, 1,1);

       s = strReplace(con2Str(con), ',', ' ');

       info(s);

  • Suggested answer
    PA-22040759-0 Profile Picture
    6,194 on at
    static void RemoveFirstWord(Args _args)
    {
        str testString = 'This is a test';
        str newString; 
        int firstSpace = strFind(testString, ' ', 1, strLen(testString));
        
        if (firstSpace)
        {
            newString = subStr(testString, firstSpace + 1, strLen(testString));
        }
        
        info (newString);
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans