传统做法:
123456
789
varcounter=0;
varstr=abc.value;
for(i=0;i
if(str.substr(i,1)=="n")
counter+=1;
}
alert(counter);
转为数组后效率就高了很多:
123456
789
alert(abc.value.split("n").length)
system.println("helloworld!")
alert("helloworld!");
messagebox_ok("helloworld")
msgbox("helloworld!")
alert("代码总行数:"+(abc.value.split("n").length-1).toString())