I am using SPFieldCurrency column in one of my lists.
My custom code receives a string value as a parameter, which contains the field’s value as returned by the GetFormattedValue() method.
Now my problem is that the value received by my method contain currency symbols in them, Eg, 10$, 10¥, 10€ etc.
Because of the presence of the currency symbols in my code, when I do a Double.TryParse() on these values, it fails.
How do I extract the numerical value from the display string value of an SPFieldCurrency object, without knowing the culture info of the currency?
Got it. The gotcha is to use NumberStyles.Any. This removes all currency symbols.
I used
Double.TryParse(valueString, NumberStyles.Any, CultureInfo.CurrentCulture.NumberFormat, out value)
It worked for me. Thanks