加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex 正则表达式对空字符串的诡异判断

发布时间:2020-12-15 03:54:00 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"minWidth="955" minHeight="600" layout="absolute"creationComplete="application1_creationCompleteHandler(event)"mx:Script![CDATA[import mx.events.Fle
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
				minWidth="955" minHeight="600" layout="absolute"
				creationComplete="application1_creationCompleteHandler(event)">
	<mx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
			// when the RegExpValidator is set require = false and the test = "",it won't do the validator!
			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				var regExp:RegExp = new RegExp("^[A-Za-z0-9]{1,8}$");
				trace(regExp.test("")); // false;
				trace(regExp.test(null)); // true !!!!!!!!!!!!!!!!!!!
			}
			
		]]>
	</mx:Script>
	
</mx:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读