导航栏: 首页 评论列表

JavaScript String 对象参考手册

默认分类 2011-04-26 23:17:27

转载:http://www.w3school.com.cn/js/jsref_obj_string.asp

<

div class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Simsun; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">

<

div class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-align: left; ">

JavaScript String 对象参考手册

String 对象

String 对象用于处理文本(字符串)。

创建 String 对象的语法:

new String(s);String(s);

参数

参数 s 是要存储在 String 对象中或转换成原始字符串的值。

返回值

当 String() 和运算符 new 一起作为构造函数使用时,它返回一个新创建的 String 对象,存放的是字符串 s  s的字符串表示。

当不用 new 运算符调用 String() 时,它只把 s 转换成原始的字符串,并返回转换后的值。

String 对象属性

FF: Firefox, IE: Internet Explorer

属性描述FFIE
constructor对创建该对象的函数的引用14
length字符串的长度13
prototype允许您向对象添加属性和方法14

<

div style=" margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 15px; padding-top: 20px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px; border-right-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-top-width: 1px; border-top-style: solid; border-top-color: rgb(170, 170, 170); border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(170, 170, 170); ">

String 对象方法

FF: Firefox, IE: Internet Explorer

<

table class="dataintable" style="font-family: Arial, Helvetica, sans-serif; margin-top: 10px; border-collapse: collapse; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); width:400px;">方法描述FFIEanchor()创建 HTML 锚。13big()用大号字体显示字符串。13blink()显示闪动字符串。1 bold()使用粗体显示字符串。13charAt()返回在指定位置的字符。13charCodeAt()返回在指定的位置的字符的 Unicode 编码。14concat()连接字符串。14fixed()以打字机文本显示字符串。13fontcolor()使用指定的颜色来显示字符串。13fontsize()使用指定的尺寸来显示字符串。13fromCharCode()从字符编码创建一个字符串。14indexOf()检索字符串。13italics()使用斜体显示字符串。13lastIndexOf()从后向前搜索字符串。13link()将字符串显示为链接。13localeCompare()用本地特定的顺序来比较两个字符串。14match()找到一个或多个正在表达式的匹配。14replace()替换与正则表达式匹配的子串。14search()检索与正则表达式相匹配的值。14slice()提取字符串的片断,并在新的字符串中返回被提取的部分。<td style="vertical-align: text-top; padding-top: 5px; padding-right: 15px; padding-bottom: 5px; padding-left: 5px; background-color: rgb(239, 239, 239); border-top-width: 1px; border-right-


>> 留言评论