Hi
I have a problem with my str conversion.
Str string = 149,2;
Str2num(string) = 149
How can i convert it correctly
*This post is locked for comments
Sadly no
Hi Ashein,
you can assign to real variable please find the below piece of code it will give your 149.20
Str string = "149.2"; real num; num = Str2num(string); info(strFmt("%1",num));
Guru
Crispin it was almost correct but when a str uses any2real it does'nt get the decimals.
And Guruprasanna, thanks it worked.
Thanks for both quick and good answers.
My fault, it did'nt work, but i think it is because of the string uses , instead of . ?
It does'nt work when there are a , instead of a .
I did a quick replace and not it works with str2num
community.dynamics.com/.../find-a-char-in-string-and-replace-new-char-using-x-in-ax2012
AX respests your Windows Regional and Location settings when it comes to string to decimal value conversion, thus it makes a difference for decimal separator, which is different between the US and majority of the EU contries (dot versus comma). When you provide the value directly as a constant in X++, it uses the comma as the separator as fixed text. When it is a string-based conversion, your locale matters.
It's an old thread but maybe this's be useful for someone:
Try to use Str2Num_RU() . It simple just put "." instead of ",".
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Community Member 4
Martin Tocauer 4
Nayyar Siddiqi 2