# Search string

**URL:** https://forum.kirupa.com/t/search-string/292298
**Category:** Uncategorized
**Created:** [July 13, 2009, 3:51am UTC](https://forum.kirupa.com/t/search-string/292298 "2009-07-13T03:51:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ggalan](https://avatars.discourse-cdn.com/v4/letter/g/8c91f0/32.png) [@ggalan](https://forum.kirupa.com/u/ggalan)
#### Post date: [July 13, 2009, 3:51am UTC](https://forum.kirupa.com/t/search-string/292298/1 "2009-07-13T03:51:52Z")

</div>

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

```auto

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);
};

```
