<script type="text/javascript">
function is_blank(str){
var reg = /^\s+$/;
return reg.test(str);
}
function del_blank(str){
var reg = /\s+/g;
return str.replace(reg,"");
}
var str_1 = " ";
var str_2 = "aa dd gg da";
alert(is_blank(str_1));
alert(del_blank(str_2));
</script>
时间: 2024-09-29 01:12:53