In Ruby, you can easily format strings using % (short for Kernel#sprintf):. Copy. '%.2f' % 1.23456 #=> 1.23 '%.2f' % 2 #=> 2.00. However, what if you only ...
確定! 回上一頁