Identify a number in different formats

Hi

What is the best approach to identify the format a number is returned in?

The output of a REST response, is a string containing different numbers, I want to do a greater/lower than comparison with a static number.

But the output can be written like 7.500 or 7500 or 7500.00 or 7500,00

If I remove the . period char in 7.500 and also in 7500.00, one of the number will be incorrect.

So how can I verify the number format and make sure that they are all compared as 7500 units?

Br
Michael

@Michaeljep

Try replacing , with . using this.

StrInput= StarInput.Replace(",",".")

Now convert the string to double using this

dblVariable=CDbl(StrInput)

Now do the comparison. Make sure your another variable or value you are comparing this also should be double datatype.

dblVariable > 7.500

@Michaeljep
Also, you can try the activity “Format Value”

Hello @Michaeljep

If the number has trailing digits, will it always be two characters?
7500,00 and 7500.00?

If so, then you could check whether the number .EndsWith “.00” or “,00” and then remove the last 3 characters.
After this you can remove all commas and dots, before you make the comparison.

Regards
Soren

@Michaeljep you can try this solution.

  1. Replace all the “.” with “,”
  2. Find the last index of “,” and replace it with “.”
  3. Remove all the “,” from you string
  4. Convert you string value to double that will give you the accurate number.