javascript---String与Arry

 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指定位置处的一个字符

 

posted @ 2014-12-30 21:21  senki  阅读(271)  评论(0编辑  收藏  举报