Ruby字符串格式化

str % arg -> aString 

Format---Uses str as a format specification, and returns the result of applying it to arg. If the format specification contains more than one substitution, then arg must be an Array containing the values to be substituted.
"%05d" % 123  » "00123" 
"%.2f" % 123  » "123.00" 

你可能感兴趣的:(Ruby)