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


ActiveSupport | Array#split

概要

Array#split

詳細

Array#split について

Array#split

文字列のsplitの配列版

サンプル

# encoding: utf-8
require 'active_support/core_ext/array/grouping'
require 'tbpgr_utils'

I18n.enforce_available_locales = true
ary = [2, 1, 3, 1, 4]
bulk_puts_eval binding, <<-EOS
ary.split 1
ary.split 2
ary.split 3
EOS

__END__
・下記はTbpgrUtils gemの機能
bulk_puts_eval

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

出力

ary.split 1 # => [[2], [3], [4]]
ary.split 2 # => [[], [1, 3, 1, 4]]
ary.split 3 # => [[2, 1], [1, 4]]



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

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