asp.net - How to change the culture of a number in C#? -
i'm sending parameters paypal hidden form vars.
but site's culture danish. "50,00" value "amount_1"
<input type="hidden" name="amount_1" value="50,00" />
i'm using code converts 50 "50,00"
item.pricepaid.tostring("#.00")
i believe number should like: "1234.56" there way set culture en-us on process? (not side wide) or better way this?
thanks!
you use overload of tostring
takes iformatprovider
, use getcultureinfo
pass in required culture info:
item.pricepaid.tostring("#.00", cultureinfo.getcultureinfo("en-us"));
alternatively, (probably) specify invariant culture rather "en-us":
item.pricepaid.tostring("#.00", cultureinfo.invarianculture);
Comments
Post a Comment