having them I have had no problems assembling the new string.
Can you help with this?
You can use String#split or a regex depending on the requirements:
irb(main):001:0> parts = “Test Part 123 G 477”.split(" ")
=> [“Test”, “Part”, “123”, “G”, “477”]
irb(main):002:0> parts[2]
=> “123”
irb(main):003:0> parts[4]
=> “477”
If you know the data is always separated by spaces and the number is
in the second and fourth places, this should work.
Jesus.
Jesus,
Thank you, I cannot guarantee that the data will always be in the same
format, however I know that the length of the string is always the same.
Can I pase the string one character at a time, and apply a set of rules
to determine what data to use and what data to discard?
For example I know that I want to use only the numerical data and not
the alphabetic data. The simplest, though not elegant way I can think of
is to go one character at a time and determine if that character is a
number or a letter.