概要
String#chars -> [String]
String#chars {|cstr| block } -> self
詳細
文字列の各文字を文字列の配列で返す。
サンプルコード
require 'tbpgr_utils' bulk_puts_eval binding, <<-EOS 'hoge'.chars 'hoge'.each_char.to_a EOS __END__ 下記はTbpgrUtils gemの機能 bulk_puts_eval https://rubygems.org/gems/tbpgr_utils https://github.com/tbpgr/tbpgr_utils
出力
'hoge'.chars # => ["h", "o", "g", "e"] 'hoge'.each_char.to_a # => ["h", "o", "g", "e"]