码迷,mamicode.com
首页 > 编程语言 > 详细

javascript---String与Arry

时间:2014-12-30 22:06:54      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
 1 var str = "liuzhanqi";
 2 document.write(str["length"]);//等价str.l ength  
 3 
 4 var str = string.fromcharcode(72, 101, 108, 108, 111, 33);
 5 document.write(str); //各整数作为unicode编码,并连接成字符串。
 6 
 7 var str1 = "liu".localecompare("zhan");//按本系统提供的默认比较规则比较当前字符串与参数字符串
 8 document.write(str1);//
 9 
10 var str2 = "liu".slice(1);//在当前字符串中提取一个子字符串
11 document.writeln(str2);
12 
13 document.writeln("se nki".split(‘ ‘));//用分隔符分割字符串,返回一个数组。
14 document.write(‘liu‘.fontcolor(‘red‘));
15 document.write(‘liu‘.fixed());//使字符串显示为等宽字
16 document.write(‘liu‘.strike());//在字符串上添加删除线
17 document.write("senki".sub());//显示为下标
18 document.write("senki".sup());//显示为上标
View Code

charCodeAt(index)  返回字符串index处的字符的Unicode编码,该值是在0~65535之间的整数,若index超出了范围,则返回NaN。

concat(str2)  将字符串str2连接在当前字符串组成一个新的字符串。

anchor(anchar_name)  创建一个锚点

link(url)  加上超链接

charAt(index)  返回字符串中index指定位置处的一个字符

 

javascript---String与Arry

标签:

原文地址:http://www.cnblogs.com/goodlucklzq/p/3634721.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!