以下の内容はhttps://tbpgr.hatenablog.com/entry/20141205/1417788565より取得しました。


Ruby | String | *

概要

String#* times -> String

詳細

文字列の内容を times 回だけ繰り返した新しい文字列を返却。

サンプルコード
require 'tbpgr_utils'

bf =->(x) { '>%s.' % (?+ * x.ord) }

bulk_puts_eval binding, <<-EOS
'hoge'*0
'hoge'*2
?+*3
'+' '-'*3
'+%s-' % '1' * 3
'hoge'.chars.map { |e|bf[e] }
EOS

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

'hoge'*0                      # => ""
'hoge'*2                      # => "hogehoge"
?+*3                          # => "+++"
'+' '-'*3                     # => "+-+-+-"
'+%s-' % '1' * 3              # => "+1-+1-+1-"
'hoge'.chars.map { |e|bf[e] } # => [">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.", ">+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.", ">+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.", ">+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++."]



以上の内容はhttps://tbpgr.hatenablog.com/entry/20141205/1417788565より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14