[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

text comparision

Karthic Ganesan

7/29/2008 2:05:00 PM

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?
--
Posted via http://www.ruby-....

1 Answer

Farrel Lifson

7/29/2008 2:12:00 PM

0

2008/7/29 Karthic Ganesan <karthic.ganesan@gmail.com>:
> 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
--
Aimred - Ruby Development and Consulting
http://www....