I need to format a negative currency as follow: $(10.00)
I tried to use string.Format("{0:C}", itemprice)
but that gives me this result ($10.00)
(the $ inside the parenthesis
i also tried
string fmt = "##;(##)";
itemprice.ToString(fmt);
but it gives me the same as before ($10.00)
Any idea on how to get a result like this: $(10.00)
.
itemPrice.ToString(@"$#,##0.00;$\(#,##0.00\)");
Should work. I just tested it on PowerShell:
PS C:\Users\Jcl> $teststring = "{0:$#,##0.00;$\(#,##0.00\)}"
PS C:\Users\Jcl> $teststring -f 2
$2,00
PS C:\Users\Jcl> $teststring -f -2
$(2,00)
Is that what you want?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With