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
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
Well, clearly the *best *way would be to create a factory class that
builds expert objects to process the various types of lists to...
Er...
Actually I'd just do this:
the_array.join
Cheers
On 29 August 2016 at 17:11, A Berger <aberger7890@gmail.com> 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
--
Matthew Kerwin
http://matthew.kerwin.net.au/
[1,2,3].join #=>"123"
Matthew Kerwin <matthew@kerwin.net.au>于2016年8月29日周一 下午3:28写道:
On 29 August 2016 at 17:11, A Berger <aberger7890@gmail.com> 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
BergWell, clearly the *best *way would be to create a factory class that
builds expert objects to process the various types of lists to...Er...
Actually I'd just do this:
the_array.join
Cheers
--
Matthew Kerwin
http://matthew.kerwin.net.au/Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Hi
ok, just thought of complicated each and map, because to_s wasn't what I
wanted.
Factory classes! I know every response contains new things, I have never
heard about
Are they used commonly in Ruby?
Thanks
Berg
Hi
ok, just thought of complicated each and map, because to_s wasn't what I
wanted.Factory classes! I know every response contains new things, I have never
heard about
Are they used commonly in Ruby?
Indeed no. That was a joke, harking back to my Software Engineering / Java
days. If you're interested, you could start at Wikipedia and work your way
from there: Software design pattern - Wikipedia
Thanks
Berg
Cheers.
On 29 August 2016 at 17:47, A Berger <aberger7890@gmail.com> wrote:
--
Matthew Kerwin
http://matthew.kerwin.net.au/
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
Matthew Kerwin <matthew@kerwin.net.au>于2016年8月29日周一 下午3:28写道:
> Well, clearly the best way would be to create a factory class that
builds expert objects to process the various types of lists to...
Er...
Actually I'd just do this:
the_array.join
Cheers
[1,2,3].join #=>"123"
Yep, that's why I suggested it.
Cheers!
On 29 August 2016 at 17:11, A Berger <aberger7890@gmail.com> wrote:
On 29 August 2016 at 17:29, timlen tse <tinglenxan@gmail.com> wrote:
--
Matthew Kerwin
http://matthew.kerwin.net.au/
From what I have read this is not common practice, but this is simple.
["a","b","c"] * ""
#join from what I have read up on is the most common way.
On Mon, Aug 29, 2016 at 3:47 AM, Matthew Kerwin <matthew@kerwin.net.au> wrote:
On 29 August 2016 at 17:11, A Berger <aberger7890@gmail.com> 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
> BergMatthew Kerwin <matthew@kerwin.net.au>于2016年8月29日周一 下午3:28写道:
>
> Well, clearly the best way would be to create a factory class that
> builds expert objects to process the various types of lists to...
>
> Er...
>
> Actually I'd just do this:
>
> the_array.join
>
> CheersOn 29 August 2016 at 17:29, timlen tse <tinglenxan@gmail.com> wrote:
>
> [1,2,3].join #=>"123"
>Yep, that's why I suggested it.
Cheers!
--
Matthew Kerwin
http://matthew.kerwin.net.au/Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
live life, but live it without regrets. A life given and laid down to
follow Yeshua, is a life worth living, because you will not regret that
choice.
Hi
YES - haven't seen the ?
Perhaps we should start a new thread with subject "Factor classes"
Have already read the wiki because of your 1st mail.
Should this concept be used in Ruby?
And thanks for short arr * char,
very nice! - Its always worth to ask here!
Cheers
Berg
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 <aberger7890@gmail.com> 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
BergUnsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>