标签:字符 取字符串 object limited 编码 长度 join www. 说明
str=”jpg|bmp|gif|ico|png”; arr=str.split(”|”); //arr是一个包含字符值”jpg”、”bmp”、”gif”、”ico”和”png”的数组
var delimitedString=myArray.join(delimiter); var myList=new Array(”jpg”,”bmp”,”gif”,”ico”,”png”); var portableList=myList.join(”|”); //结果是jpg|bmp|gif|ico|png
arr1=[1,2,3,4] arr2=[5,6,7,8] alert(arr1.concat(arr2)) //结果为[1,2,3,4,5,6,7,8]
var str=‘a,g,i,d,o,v,w,d,k,p‘ alert(str.charAt(2)) //结果为g
var str=‘a,g,i,d,o,v,w,d,k,p‘ alert(str.charCodeAt(2)) //结果为103。即g的Unicode编码为103
var str=‘ahji3o3s4e6p8a0sdewqdasj‘ alert(str.slice(2,5)) //结果ji3
var str=‘ahji3o3s4e6p8a0sdewqdasj‘ alert(str.substring(2,6)) //结果为ji3o3
var str = "0123456789"; alert(str.substring(0));------------"0123456789" alert(str.substring(5));------------"56789" alert(str.substring(10));-----------"" alert(str.substring(12));-----------"" alert(str.substring(-5));-----------"0123456789" alert(str.substring(-10));----------"0123456789" alert(str.substring(-12));----------"0123456789" alert(str.substring(0,5));----------"01234" alert(str.substring(0,10));---------"0123456789" alert(str.substring(0,12));---------"0123456789" alert(str.substring(2,0));----------"01" alert(str.substring(2,2));----------"" alert(str.substring(2,5));----------"234" alert(str.substring(2,12));---------"23456789" alert(str.substring(2,-2));---------"01" alert(str.substring(-1,5));---------"01234" alert(str.substring(-1,-5));--------""
转载至:https://www.cnblogs.com/qj0813/p/5110211.html
标签:字符 取字符串 object limited 编码 长度 join www. 说明
原文地址:https://www.cnblogs.com/bgwhite/p/10000230.html