【发布时间】:2011-08-22 14:28:46
【问题描述】:
如果我有一个变量 x,它有时是一个普通的可打印字符串,有时是一些随机的十六进制数据(包括不可打印的字符),我怎样才能可靠地打印出填充空间?例如:
def print(x)
puts("%-15s" % x)
end
x = "test"
print(x)
x = Array.new(256) { rand(256) }.pack('c*')
print(x)
【问题讨论】:
-
that will sometime be a ...,print that will space padding?错别字?