how to convert string ($23.25) to Decimal -$23.25 in selenium with C# -


i using xpath string shown in format ($23.25) should converted -$23.25. have tried:

decimal.parse(string, numberstyles.allowcurrencysymbol | numberstyles.number); 

but not returning negative value.

instead of numberstyles.number use numberstyles.allowparentheses.

var balance = decimal.parse("($23.25)", numberstyles.currency | numberstyles.allowparentheses); // -23.25 

if format "-$23.25", here how :

balance.tostring("$0.00") // -$23.25 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -