Lets say I have the string "first=53 second=65 third=82"
. How do I assign each value to variables x
, y
, z
?
Edit: The words must match as well. With the + signs and exact number of spaces.
Lets say I have the string "first=53 second=65 third=82"
. How do I assign each value to variables x
, y
, z
?
Edit: The words must match as well. With the + signs and exact number of spaces.
str = "first=53 second=65 third=82"
x, y, z = str.scan(/\d+/).map(&:to_i)