Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

str2int function returns incorrect value with minus sign

(0) ShareShare
ReportReport
Posted on by 793

Hello guys,

I have some code where str2int function return incorrect value with minus sign. It doesn't match the parameter and also it adds "-" sign. What does that mean? I'm sure that it accepts the variable of the string type.

One of the examples:

str2int("2711838385");

it returns integer = -1583128911

never faced such things before.

  • Yuji Imaoka Profile Picture
    on at
    RE: str2int function returns incorrect value with minus sign

    The customer uses str2int64 instead of str2int.

  • dark_knight Profile Picture
    793 on at
    RE: str2int function returns incorrect value with minus sign

    yes. figured it out by myself already. Thanks.

  • Community Member Profile Picture
    on at
    RE: str2int function returns incorrect value with minus sign

    Use str2int64 instead. 

    int is a 32 bit integer, with range of  -2,147,483,647 to 2,147,483,647. Your value is higher and the compiler do a overflow in the memory allocated.

  • dark_knight Profile Picture
    793 on at
    RE: str2int function returns incorrect value with minus sign

    resolved by myself. Sorry for disturbance.

  • dark_knight Profile Picture
    793 on at
    RE: str2int function returns incorrect value with minus sign

    I got that 2711838385 is too big for int but str2int64 doesn't help also. It proceeds to return minus value.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,041 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,860 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans