I have a dynamic string (in Ruby program) and I need to split it if it is longer then 91 chars. I need to split it into parts on closes comma ‘,’ char.
String example:
"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41"
Thank you!
This is what you need:
Result:
Or an array with joined values:
Result:
UPDATE:
With plain Ruby (not Rails):
or joined: