Hi,
I need to compare one number to another.
The second one is always in format like “999.999,99” or “999,99”,
the first one can be same or anything else (“9,999.99” / “9.999,99” / “9,99” / “9.99”).
Any suggestions?
Thx and KR, Vanja
Hi,
I need to compare one number to another.
The second one is always in format like “999.999,99” or “999,99”,
the first one can be same or anything else (“9,999.99” / “9.999,99” / “9,99” / “9.99”).
Any suggestions?
Thx and KR, Vanja
@VanjaV Can you please add more details?
What result or output are you expecting from the given input value?
(“9,999.99” / “9.999,99” / “9,99” / “9.99”) this is mix of US and EU format so you need to convert it.
Try bellow method
Try
`Assume first Input might be US or EU
`First attempt: try parsing with en-US
number1 = Decimal.Parse(number2_Str, New System.Globalization.CultureInfo("en-US"))
Catch
`Fallback: try parsing with EU format
number1 = Decimal.Parse(number1_Str, New System.Globalization.CultureInfo("fr-FR"))
End Try
`Second number is always in EU format
number2 = Decimal.Parse(number2_Str, New System.Globalization.CultureInfo("fr-FR"))
`Now compare
if (number1 =number2 )
Hi @adi.mehare thx :)!
How can I recognize if comma is comma or dot?
Except of making a substring?
Because now it makes 90000 out of 900.00:
![]()
You can try this approach
Double.Parse(str_YourNumber.Trim.Replace(“.”, “”).Replace(“,”, “.”), Globalization.CultureInfo.InvariantCulture)
If this is needful mark it as SOLTUION
Happy Automation
thx, but it does not work:

I’m assuming it is a first number as we are considering second number as EU format.
It should work,
but if 900.00 is a second number then it will throw error.
this is output when i try
Hi @adi.mehare
it works now fine for me. I check if decimal comma or dot and
consequently use the appropriate method.
Thx a lot! ![]()
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.