I am faced with a specific problem regarding a string that needs to be parsed as a float. The string in question is:
const NumberAsString = "75,65";
Traditionally, it is recommended to replace the comma
with a dot
when parsing numbers where the comma acts as a thousand separator. However, in this instance, the comma serves as a decimal separator. If I were to replace it with a dot, the resulting number would be incorrectly displayed as: 7.565,00
, which is not the desired outcome of 75.65
. Are there any alternative methods to parse this number as a float without altering its value?
Additionally, my system has a built-in helper function that interprets numbers with dots as thousand separators and commas as decimal separators. Unfortunately, changing this functionality is not an option for me.