Convert string value to double and calculate

Hello,
we have already implemented some processes but now for the first time the task of calculating with monetary values. These values are available as string values and must therefore be converted.
Yes, there is the CDbl or Cdec function. However, both have the disadvantage that they do not correctly recognize German comma values, for example.
My solution is attached as an xaml example inside of a zipConvertStringToDouble.zip (2.1 KB)
.
There I created a Culturinfo variable and initialized it with “de-DE”. For other languages you can change the desired info accordingly.
I hope it helps someone and I think it will also work for decimal values…
Ups: I found that in the examlpe is a little mistake-> I converted two times the same value :wink:

1 Like

@martinN
Check this please
ConvertStringToDouble.xaml (14.0 KB)

Hi Martin, welcome back!

I’ve used the same solution with the german CultureInfo before and it works like a charm. Nice of you to share your solution here.

In some special cases the default CultureInfos won’t fit though, because they come with predefined “NumberDecimalSeparator” and “NumberGroupSeparators” - you can set custom separators for cases like these though - check references:

Cheers,
Lukas

have a look here:

Thanks for all contributions and suggestions. However, I did not want to open a discussion, I just wanted to offer a solution to those who need it. Certainly there are still different solutions, but I didn’t want to open an endless discussion now.

Well, you posted in the Help section of the forum, where people come to offer help. You could’ve chosen the tutorial section :wink:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.