How can I know if a specified string is contained in a text?

You can use several expressions:

set theText to "this is a sample"
set lookingFor to "sample"

offset of lookingFor in theText --> if result is not "0", then it is contained
theText contains lookingFor --> true or false, by default ignores case
lookingFor is in contents of theText --> the same

If you are looking for more options and power, take a look to the find text command of the Satimage osax, or use any command-line tool, such as grep.