Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Retrieve part of a string.

Posted on by Microsoft Employee

Hi All,

I need to retrieve part of string. The 'substr' will be an option but the length of the string can be changed.

Here the sample:

826482-123-21417-11253 - I need to retrieve '123-21417-11253'.  As I said 'subStr' will be an option but the length of the string can be

changed (for exp.: 8266-123-21417-11253).

So, basically, I need to retrieve a part after the first '-' 123-21417-11253.

Does anyone of you have a suggestion?

Many thanks.

*This post is locked for comments

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Retrieve part of a string.

    I find it hard to read substring conversions/concatenations, so I encourage people to use containers (with str2con) or lists (with strSplit) for string manipulation instead.

    Try something like this:

    con2str(conDel(str2con(yourString, @'-'), 1, 1), @'-');
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Retrieve part of a string.

    Thank you! It worked.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans