开发者

Using some sort of "Contains()" function in ActionScript 2

开发者 https://www.devze.com 2023-02-05 02:35 出处:网络
Is there any way to parse a string looking at it with some sort of \"contains\" function in actionscript 2 ? I tried sear开发者_Go百科ching for this online but I can\'t find anything.

Is there any way to parse a string looking at it with some sort of "contains" function in actionscript 2 ? I tried sear开发者_Go百科ching for this online but I can't find anything.

I'm using a form that has a input for an email, and I wanted to check if that email contain's "@" and ".com" to c heck if its valid.

Here is a fictional example of what I wanted to accomplish:

if( emailInput.text.contains ( "@" ) ) {
  trace("Ok");
} else {
  trace("Not ok");
}

Thanks.


I think you are looking for indexOf("@") which will return the index of the string or else -1 if it can't find it.

More info: http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001551.html

0

精彩评论

暂无评论...
验证码 换一张
取 消