Re: Array to string

Samir Arapcic <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <CA+oejn8GtCt1UQQHqbA4JOz774Ewo0x=DCGx78XiiX_ufHfJHA@mail.gmail.com>
Try this

a=["a","b","c"]
b = a.join.to_s

a=[1,2,3,4,5]
b = a.join.to_s

On Mon, Aug 29, 2016 at 9:11 AM, A Berger <[email protected]> wrote:

> Hi
> Whats the most elegant / shortest way to convert an array to a string, like
> a=["a","b","c"]  # => "abc"
>
> And the best way for
> a=[1,2,3,4,5]  # => "12345"
>
> Thanks
> Berg
>
>
> Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
>
>


Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
array_to_string.jpg (image/jpeg, 33.6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.