hi, forks…
see this source
irb(main):015:0> puts “%*s” % [ “1”, 2 ]
TypeError: can’t convert String into Integer
from (irb):15:in `%’
from (irb):15
from :0
irb(main):016:0>
AIK, “%*s” is to use for concatenation of array.
but, I met the previous error message.
What’s different ways I can take?
From: Jun Y. Kim [mailto:[email protected]]
#…
AIK, “%*s” is to use for concatenation of array.
can you point me a link to that info?
afaik, “*” is used for field widths, eg,
p “%*s” % [2,“1”]
" 1"
p “%*s” % [2,1]
" 1"
p “%.*s” % [2,“abcdef”]
“ab”
From: Peña, Botp [mailto:[email protected]]
afaik, “*” is used for field widths, eg,
or precisions
> p “%*s” % [2,“1”]
" 1"
> p “%*s” % [2,1]
" 1"
> p “%.*s” % [2,“abcdef”]
“ab”
also, if just plain concat, %s will do
puts “%s” % [[“1”, 2]]
12
irb(main):015:0> puts “%*s” % [ “1”, 2 ]
TypeError: can’t convert String into Integer
from (irb):15:in `%’
from (irb):15
from :0
irb(main):016:0>
Maybe you meant “%*s” % [ 2, “1” ] if you expect " 1".
mfg, simon … l
thanks, wrong knowledge is more worse than wrong action.
-
- 24, 오후 3:52, Peña, Botp 작성:
" 1"
p “%*s” % [2,1]
" 1"
p “%.*s” % [2,“abcdef”]
“ab”
DSLab, CQ ê¹€ì¤€ì˜ ë“œë¦¼
(02-2082-1091)