# String compare doesn't work

**URL:** <https://forum.kirupa.com/t/string-compare-doesnt-work/304387>\
**Category:** flash\
**Created:** [February 6, 2010, 9:14pm UTC](https://forum.kirupa.com/t/string-compare-doesnt-work/304387 "2010-02-06T21:14:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadaj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kadaj/32/9061_2.png) [@kadaj](https://forum.kirupa.com/u/kadaj)\
**Post date:** [February 6, 2010, 9:14pm UTC](https://forum.kirupa.com/t/string-compare-doesnt-work/304387/1 "2010-02-06T21:14:04Z")

</div>

How to compare a string with strings inside an array for a match?

I have a file in which each sentence (or word) (generally string) is present in a new line.  
Opened the file and read the contents to a string.

```auto

		private function readHandler(event:Event):void
		{
			_str = _readStream.readUTFBytes(_readStream.bytesAvailable);
			_strArray = _str.split("
"); //contains each string that appears in a new line 
			_length = _strArray.length;
		}
                
                public function searchList(input:String):Boolean
		{
			_input = input;

			_isFound = false;
			for(i=0; i<_length; i++) {
				if(_input == _strArray*) {
				//	trace("_input: "+_input+" _strArray["+i+"]: "+ _strArray*);
					_isFound = true;
					break;
				} else {
					_isFound = false;
					continue;
				}				
			}

			if(_isFound)
				return true;
			else
				return false;
		}

```

But this doesn’t work. Seems like if(\_input == \_strArray\*) never gets executed even if they are equal. What might be the problem. Is there some better way to so it?
