Hi all,
array=[“api”,“api2”]
array.join(’,’)
i get ''api,api2"
wat i want is ‘api’,‘api2’
how can i get it
Hi all,
array=[“api”,“api2”]
array.join(’,’)
i get ''api,api2"
wat i want is ‘api’,‘api2’
how can i get it
a little hackish but
“’#{array.join(’’,’’)}’”
or
array.join(’,’).inspect.gsub(/[]/, ‘’)
On Thu, Feb 17, 2011 at 12:55 PM, loganathan sellappa <[email protected]
gmail.com> wrote:
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
–
On 17 February 2011 04:55, loganathan sellappa [email protected]
wrote:
array=[“api”,“api2”]
wat i want is ‘api’,‘api2’
how can i get it
array.map{|e| “’#{e}’”}.join(’,’)
Can’t try it out because I can’t reach my development machine and I did
not
need such behavior but intuitively I would try
“’” + array.join("’,’") + “’”
it is " followed by ’ for opening and vice versa for closing. The ’ in
the
resulting string at the beginning and the end had to be added manually
by
adding “’”.
HTH
Norbert
Top posted from android
Am 17.02.2011 05:55 schrieb “loganathan sellappa”
[email protected]:
–
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks lot,its works well
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