Search string

i have a input text field on stage called textfield and a button called btn
i want to be able to search for key words from the users input
i found this code but it doesnt work, can anyone help out


function searchText(sS:String, tF:TextField):Void 
{
    var tS:String = tF.text.toUpperCase();
    var tW:String = (" "+sS.toUpperCase()+" ");
    if (tS.indexOf(tW)>0) 
    {
        trace("TRUE");
    }
    else
    {
        trace("doesnt work");
    }
}

btn.onRelease=function() 
{
    searchText("book", textfield);
};