Hi, I am reading a value in SAP with the “get text” activity. Then I want to convert the variable string to double so that I can calculate with it. However, this does not work because there is sometimes a negative sign after the number.
Double.Parse("1,0-", NumberStyles.Any, new CultureInfo("de-DE"))
-1
Double.Parse("-1,0", NumberStyles.Any, new CultureInfo("de-DE"))
-1
Double.Parse("123.45,34-", NumberStyles.Any, new CultureInfo("de-DE"))
-12345.34
it is preferred to do such conversions with the API instead of with String Manipulations. Any failings/exception trackings allow to set up a more reliable implementation e.g. TryParse checks