I have an array:
int_array = [11,12]
I need to convert it into
str_array = ['11','12']
I'm new to this technology
I have an array:
int_array = [11,12]
I need to convert it into
str_array = ['11','12']
I'm new to this technology
Start up irb
irb(main):001:0> int_array = [11,12]
=> [11, 12]
irb(main):002:0> str_array = int_array.collect{|i| i.to_s}
=> ["11", "12"]
Your problem is probably somewhere else. Perhaps a scope confusion?
x = [1,2,3,4,5,6,7,8,9,10] # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = 1,2,3,4,5 # => ["1", "2", "3", "4", "5"]