浅谈javascript中字符串String与数组Array
简单点就是string是字符(串)...
而array是数组...可以放数字啊,字符啊等一系列东东!!!
上个示例:
varstr="liuzhanqi";
document.write(str["length"]);//等价str.length
varstr=string.fromcharcode(72,101,108,108,111,33);
document.write(str);//各整数作为unicode编码,并连接成字符串。
varstr1="liu".localecompare("zhan");//按本系统提供的默认比较规则比较当前字符串与参数字符串
document.write(str1);//
varstr2="liu".slice(1);//在当前字符串中提取一个子字符串
document.writeln(str2);
document.writeln("senki".split(''));//用分隔符分割字符串,返回一个数组。
document.write('liu'.fontcolor('red'));
document.write('liu'.fixed());//使字符串显示为等宽字
document.write('liu'.strike());//在字符串上添加删除线
document.write("senki".sub());//显示为下标
document.write("senki".sup());//显示为上标
charCodeAt(index) 返回字符串index处的字符的Unicode编码,该值是在0~65535之间的整数,若index超出了范围,则返回NaN。
concat(str2) 将字符串str2连接在当前字符串组成一个新的字符串。
anchor(anchar_name) 创建一个锚点
link(url) 加上超链接
charAt(index) 返回字符串中index指定位置处的一个字符
小伙伴们是否了解了javascript中字符串String与数组Arry了呢,有疑问请给我留言吧,大家共同进步。
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短