GhostRider GhostRider - 1 year ago 77
Ruby Question

Ruby:concatenate pairs of strings in an array

Given the array

["zone", "abigail", "theta", "form", "libe", "zas"]

Is there a straightforward way to go through the array and combine the strings into pairs, thus...

["zoneabigail", "abigailtheta", "thetaform", "formlibe", "libezas"]

ndn ndn
Answer Source

You are searching for Enumerable#each_cons:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download