Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Entries from 2004-04-28 to 1 day

String to Array

# 一文字ずつ Array に納める array = str.split(//) # char[] みたいにする array = str.unpack("C*") "a b c".unpack("C*") => [97, 32, 98, 32, 99] "a b c".split(//) => ["a", " ", "b", " ", "c"] "a b c".split() => ["a", "b", "c"]