js String

...

// String 对象方法
// http://www.w3school.com.cn/jsref/jsref_obj_string.asp
// HTML 相关的方法
var str = "asd";
document.write(str.length); 
    //length 方法:字符串的长度
document.write("<br\>");
document.write(str.bold()); 
    // bold()     使用粗体显示字符串。
document.write("<br\>");
document.write(str.fontcolor("Red")); 
    // fontcolor()     使用指定的颜色来显示字符串。
document.write("<br\>");
document.write(str.bold()); 
    // fontsize()     使用指定的尺寸来显示字符串。
document.write("<br\>");
document.write(str.bold()); 
    // link()     将字符串显示为链接。
document.write("<br\>");
document.write(str.bold()); 
    // sub()     把字符串显示为下标。
document.write("<br\>");
document.write(str.bold()); 
    // sup()     把字符串显示为上标。

/* java相关的方法
    concat()     连接字符串。
    charAt()     返回在指定位置的字符。
    indexOf()     检索字符串。
    split()     把字符串分割为字符串数组。
    replace()     替换与正则表达式匹配的子串。
    
    substr()     从起始索引号提取字符串中指定数目的字符。
    substring()     提取字符串中两个指定的索引号之间的字符。

*/

 

posted @ 2019-01-16 15:18  SilentKiller  阅读(93)  评论(0)    收藏  举报