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)

String to int conversion

(0) ShareShare
ReportReport
Posted on by

Hello!

I have this part of code:

someInt = str2int(someString);

info(someString + " " + int2str(someInt));

And the resoult is:

5 0

Any other ways to parse string to int?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Hi.

    Your job shows the correct results when i run it:

    static void Job1(Args _args)

    {

       int someInt;

       str someString = "5";

       someInt = str2int(someString);

       info(someString + " " + int2str(someInt));

    }

    How are you calling your code?

  • Community Member Profile Picture
    on at

    ok, This code really work. I put not the string I want to.

  • Douglas Noel Profile Picture
    3,905 on at

    Hi,

    did you check the unicode value of your single unicode char string?

    maybe you have something similar what only look like the '5' digit within that?

    only some example

        str somestring2 = num2char(53);
        // DIGIT_FIVE  5       U+0035    (53)
        str somestring3 = num2char(65301); 
        //FULLWIDTH_DIGIT FIVE U+FF15 (65301)
        // str2int will convert this to zero
        int someint2;
        int someint3;
        ;
        someint2 = str2int(somestring2);
        someint3 = str2int(somestring3);
        info(somestring2+ " "+int2str(someint2));
        info(somestring3+ " "+int2str(someint3));
    

    regards

    Douglas

  • Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    Hi, you say the code is not working. Please explain exactly what's wrong, what do want to do? Thanks!

  • Community Member Profile Picture
    on at

    I think what he meant is that the code works, but he used the wrong string.

  • Community Member Profile Picture
    on at

    that is exactly what I meant to :)

  • Jonathan  Halland Profile Picture
    11,310 on at

    Can you mark your or others peoples responses as answered/verified so that people are aware the thread is closed

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