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.
当打印浮动时,ruby在句号之后1234.0只打印一个0。如何强制 ruby 打印两个0s?
1234.0
0
格式化字符串以进行救援:
>> puts "%.2f" % 1.0 #=> nil 1.00