Hi!
How to write i.e. array.join! based on array.join method?
Hi!
How to write i.e. array.join! based on array.join method?
On 3/14/06, szymek [email protected] wrote:
Hi!
How to write i.e. array.join! based on array.join method?
What could this possibly mean? You have an array and you want to
store a string inside of it?
It would help if you could explain what you’re really trying to do.
– James
Hi –
On Tue, 14 Mar 2006, szymek wrote:
Hi!
How to write i.e. array.join! based on array.join method?
array = []
def array.join!(sep=$,)
join(sep)
end
But I doubt that’s what you mean
! means a “dangerous” version of a method. I’m not sure what a join
can do that’s dangerous. Many ! methods change their receivers, but
you can’t change an array object into a string object.
David
–
David A. Black ([email protected])
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)
“Ruby for Rails” chapters now available
from Manning Early Access Program! Ruby for Rails
you can’t change an array object into a string object
With all these one_line_that_does_billions_of_things methods in ruby i
tried to reuse my array variable to store a string, so i won’t have to
introduce new variable. I forgot that it will be different object
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs