<script>
var nowpic=0
var patt1=new RegExp("t","g");
do
{
result=patt1.exec("The best things in life are free");
nowpic++
}
while (result!=null)
document.write(nowpic-1);
</script>
用js判断一个字符串中某个字符出现的次数
最新推荐文章于 2024-06-15 20:54:10 发布
<script>
var nowpic=0
var patt1=new RegExp("t","g");
do
{
result=patt1.exec("The best things in life are free");
nowpic++
}
while (result!=null)
document.write(nowpic-1);
</script>