M
Matthew Margolis
The code below is supposed to scan through a string and put a ','
before all zip codes. The code properly detects the zip codes and makes
the change in x but the change is never reflected in thestring. How can
I get these changes to exist outside of x's scope?
thestring.each do |x|
if x =~ /\d{5}/
puts "match"
x[-6] = ","
puts x
end
end
Thank you,
Matthew Margolis
before all zip codes. The code properly detects the zip codes and makes
the change in x but the change is never reflected in thestring. How can
I get these changes to exist outside of x's scope?
thestring.each do |x|
if x =~ /\d{5}/
puts "match"
x[-6] = ","
puts x
end
end
Thank you,
Matthew Margolis