Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前使用这个
$Profit = -8.2 ; printf("%8s",sprintf("\$%0.2f",$Profit)).
哪个打印
$-8.2
有没有快速简便的打印方法
-$8.2
sprintf("%s\$%0.2f", $Profit >=0 ? "" : "-", abs($Profit))
5.14+:
sprintf("%0.2f", $Profit) =~ s/^-?\K/\$/r