Skip to content

convert array to string

April 13, 2011

I may have written a similar post about this, but  i doubt that it is identical. anyways, the inject method can be used well to convert an array of characters to a string

ruby-1.9.2-p136 :059 > ['a', 'b', 'c', 'd', 'e'].inject(:+)
 => "abcde"
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: