2017-11-28から1日間の記事一覧

Ruby: splitで分割対象を残す

こんな感じ。 普通のsplit "090-1234-5678".split("-") # => ["090", "1234", "5678"] splitしたものを結果に含める "090-1234-5678".split(/(-)/) # => ["090", "-", "1234", "-", "5678"] 改訂2版 パーフェクトRuby作者: Rubyサポーターズ出版社/メーカー:…