Why not just:

public static function contains(str:String, val:String):Boolean {
        return str.indexOf(val) >= 0;
}

?

A tad more concise (you don't need the "? true : false" part), and
avoids the problem your function has that if str is null or undefined,
it returns true.
―
Mike Keesey

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Jim Kremens
> Sent: Tuesday, September 12, 2006 11:25 AM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] does actionscript have something like sql's
IN
> orLIKE ?
> 
> Hi,
> 
> Try this for checking if one string contains another:
> 
>  public static function contains(str:String, val:String):Boolean {
>   return str.indexOf(val) != -1 ? true : false;
>  }
> 
> Also, try to avoid attaching your functions directly to buttons, as it
> makes
> scoping tricky:
> 
>  this.opened_btn.onRelease=function(){
> 
> Check out the Proxy class here for a better way to handle that:
> http://www.person13.com/articles/proxy/Proxy.htm
> 
> Hope that helps,
> 
> Jim Kremens
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to