array = [
[0] "Bonk Radek S Male Green 6/3/1978",
[1] "Bouillon Francis G Male Blue 6/3/1975",
[2] "Smith Steve D Male Red 3/3/1985"
]
at the moment each string is formatted:
Last Name, First Name, Middle, Gender, Fav Color, Birth Date
I need to write code that will format it:
last name, first name, middle, gender, date of birth, favorite color
How do I rearrange the strings to be in the format I want and return the array?
------------------------------------------------------------------------------array = [
"Bonk Radek S Male Green 6/3/1978",
"Bouillon Francis G Male Blue 6/3/1975",
"Smith Steve D Male Red 3/3/1985"
]
array.map { |s| s.sub(/(\S+)(\s+)(\S+)$/, '\3\2\1') }