I came across the following statement, where “input_string” is an string
that has been returned by “gets.chomp”:
if (line =~ /#{input_string}/)
What does this statement mean?
Thanks.
I came across the following statement, where “input_string” is an string
that has been returned by “gets.chomp”:
if (line =~ /#{input_string}/)
What does this statement mean?
Thanks.
SW Engineer wrote in post #1168474:
I came across the following statement, where “input_string” is an string
that has been returned by “gets.chomp”:if (line =~ /#{input_string}/)
What does this statement mean?
It creates a regex on the fly from content of input_string.
PS: Try it out in IRB.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs