I have a string (e.g. "AABBCCDDEEFF") and want to split this into an array with each element containing two characters - ["AA", "BB", "CC", "DD", "EE", "FF"].
Try the String object's scan method:
>> foo = "AABBCCDDEEFF" => "AABBCCDDEEFF" >> foo.scan(/../) => ["AA", "BB", "CC", "DD", "EE", "FF"]
2.1m questions
2.1m answers
60 comments
57.0k users