How do I get ISO 3 Amount from given currency?
I am working with an API that expects currency to be multiplied by ISO 3 code.
Given I have a table that gives me the values for ISO 4217 as follows:-
CURRENCY, DECIMAL
JOD 3
AED 2
and so on.
and for example: If the amount value was 500 AED; according to ISO code 3, you should multiply the value with 100 (2 decimal points); so it will become 50000. Another example: If the amount value was 100 JOD; according to ISO code 3, you should multiply the value with 1000 (3 decimal points); so it will become 100000.
Given I have the amount 500 and knowing the decimal for AED is 3 how do I get the 50000?
My approach is as follows but don't think its right.
decimal amount = 500m;
int decValue = 3;
var decimalAmount = (amount * decValue * 100); //50000
from Recent Questions - Stack Overflow https://ift.tt/3o7GzYV
https://ift.tt/eA8V8J
Comments
Post a Comment