Convert an array of integers into an array of strings in Ruby?

后端 未结 7 1016
野的像风
野的像风 2020-12-12 18:47

I have an array:

int_array = [11,12]

I need to convert it into

str_array = [\'11\',\'12\']

I\'m new to t

相关标签:
7条回答
  • 2020-12-12 19:42
    str_array = int_array.collect{|i| i.to_s}
    
    0 讨论(0)
提交回复
热议问题