Hyphens

how can I scan a string and chop it of to a words without losing the
hyphens ?
EG: apple $ two ( to be
will be saved in the array
as array = [‘apple’, ‘$’ , ‘two’, ‘(’ , ‘to’ , ‘be’]
thank you

how can I scan a string and chop it of to a words without losing the
hyphens ?
EG: apple $ two ( to be
will be saved in the array
as array = [‘apple’, ‘$’ , ‘two’, ‘(’ , ‘to’ , ‘be’]
thank you

split?

‘apple $ two ( to be’.split

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs