Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

RE: Str2num does'nt get the decimals

$
0
0

At that time i have to write condition for all languages in ax?. I understand our point Can you please provide  one example for better understand, and I am developing code in d365 environments

below is my code

Below is the my code  

ledgerjournaltrans.amountcurdebit       = str2num(conpeek(modcontainer, #amountcurdebit));

ledgerjournaltrans.amountcurcredit      = str2num(conpeek(modcontainer, #amountcurcredit));

Below Example is your suggestion right? shall i use  or else is there any way to simplify the code

value = "$6,032.51";

style = NumberStyles.Number | NumberStyles.AllowCurrencySymbol;

provider = new CultureInfo("en-GB");

try

{

  number = Decimal.Parse(value, style, provider);  

  Console.WriteLine("'{0}' converted to {1}.", value, number);

}  

catch (FormatException)

{

  Console.WriteLine("Unable to parse '{0}'.", value);

}

// Displays:

//    Unable to parse '$6,032.51'.

provider = new CultureInfo("en-US");

number = Decimal.Parse(value, style, provider);  

Console.WriteLine("'{0}' converted to {1}.", value, number);


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>