javascript (string 部分)
<html> <body> <script type="text/javascript"> var str="ab:cd:ef:gh" var txt="Hello World!" document.write(txt.length) document.write("<p>Big: " + txt.big().big().big() + "</p>") document.write("<p>Small: " + txt.small() + "</p>")//设置字体大一号或者小一号 document.write("<p>Bold: " + txt.bold() + "</p>") document.write("<p>Italic: " + txt.italics() + "</p>")//设置字体斜体或粗体 document.write("<p>Strike: " + txt.strike() + "</p>")//文字被杠掉,删除线 document.write("<p>Fontcolor: " +txt.fontcolor("Red") + "</p>") document.write("<p>Fontsize: " + txt.fontsize(30) + "</p>")//设置字体颜色和大小 document.write("<p>Lowercase: " + txt.toLowerCase() + "</p>") document.write("<p>Uppercase: " + txt.toUpperCase() + "</p>")//大小写转换 document.write(txt.replace(/World/,"Wow"))//替换文字 document.write(txt.indexOf("Hello") + "<br />")//0 document.write(txt.indexOf("World") + "<br />")//6 document.write(txt.indexOf("world"))//-1查询文本第一次出现的位置,如果没有的话,就返回-1 document.write(txt.match("Hello") + "<br />")//查找字符串中的字符,若有则返回字符 document.write(txt.match("World") + "<br />")// document.write(txt.match("world") + "<br />")//没有的话则返回null document.write(txt.substr(3) + "<br />")//从3为下标截取到结束 document.write(txt.substr(3,5) + "<br />")//从3为下标截取5个字符 document.write(txt.substring(3) + "<br />")//从3为下标截取到结束 document.write(txt.substring(3,7) + "<br />")//从3为下标截取到7为下标(不包括7) document.write("<p>Link: " + txt.link("http://www.baidu.com") + "</p>")//给文字添加上超链接 document.write("分隔字符串"+str.split(":")) document.write("分隔字符串"+txt.split("",3))//返回的数组长度为3 </script> </body> </html>