<html> <head> <script type="text/javascript"> //创建 var str = "aaafga"; var str1 = new String("aa"); var str2= String("aaasdrf"); //属性length alert(str.length); //方法charAt() alert(str2.charAt(3));//s //方法concat(str1,str2...) alert(str.concat("dfa","55454")); //方法indexOf alert(str.indexOf("a",1));//1 // 方法replace(); alert(str.replace("a","k"));//kaafga //方法 split(); var st = "1-2-3-5-4-1-2"; var v = st.split("-"); alert(v.length);//7 alert(v[0]);//1 // </script> </head> <body> this is my file </body> </html>
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-12 16:00:49