Sum values from screen scraping

I have the dollar value extracted from a web, in the following format: 44,30 now, i have to extract more values and then i have to make an average of the four values. how can i make that? the "" is making me gettin crazy.
i need to convert all my values in an Int format to sum, but i can’t.

Just convert the string variable to another type:

Assuming doubles, you can either use Double.Parse(s) or Double.TryParse(s, d). The difference is that Parse will fail when the string can’t be converted while TryParse will yield false, for example allowing you to ignore the value. This can be a bit more elegant than a Try/Catch block, but that depends on your requirements - maybe you need to throw an error if value could not be converted.

it’s not being useful… Double.Parse(var), removes the comma right?
bcs it breaks my workflow

Double.Parse(x.Replace(",", “.”))

This swill replace the comma into dot and then parse it as Double.

Eg. x = “44,30” (string)
Output = 44.30 (double)

1 Like

@HalmiNordin that’s one of the topics i wanted to investigate. i’m in argentina and commas works like dots. but it’s not easy work changin by hand all my values.
but it fixes my error
thanks :slight_smile:

1 Like

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