Hi,
I am trying to build a logic to parse the amounts which are present in the source data in the below formats.
Format-1 : Comma is used as thousand separator and Dot is used as decimal separator. e.g. 1,234.456
Format-2 : Dot is used as thousand separator and Comma is used as decimal separator. e.g. 1.234,456
Approach : The amounts are read as string and then regex match is used to identify the format. After format is identified, the commas are removed and decimal point is put in the appropriate place. For e.g. if Input amount is 1.234,456, output is 1234.456.
Challenge: The logic breaks when the input amount is e.g. 123.345. Because "." could be decimal or thousand separator.
It results in ambiguity when pattern is used to match the amount format.
Please let me know if you have any idea. Waiting for your answer.
Thanks,
Mohith