<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script language="javascript">
<!--
var p = /\s/;
var strH = ' test';//Space at head
var strB = 'te st';//Space at body
var strT = 'test ';//Space at tail
var strA = ' te st ';//Space at head & body & tail
alert('resultH='+p.test(strH)+'\n'+'resultB='+p.test(strB)+'\nresultT='+p.test(strT)+'\nresultA='+p.test(strA));
// -->
</script>
</head>
<body>
</body>
</html>
验证字符串中是否包含空格
最新推荐文章于 2022-04-11 20:41:05 发布