Text comparision

hi,

i need to check the text “Test” from a dropdown list that contains more
than 100 char.
i have taken the text from dropdown list and store it in a variable a.(i
dont know is it correct or not)
that is if i execute “puts a” statement then it shows “abcd efg hij Test
klmno pqrs tuvw xyz” .

now i need to check the text “Test” from variable a.
i have tried,

b=“Test”
if a== %b%

and is no luck.

could anybody know how to perform this task?

2008/7/29 Karthic G. [email protected]:

now i need to check the text “Test” from variable a.
i have tried,

b=“Test”
if a== %b%

and is no luck.

could anybody know how to perform this task?

Try using a regular expression:
b = /Test/
if b =~ a
# Do stuff
end

Farrel

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