⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.html

📁 javascript 1.5规范
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<P><A NAME="1193249"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the character at the specified index.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193254"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196647"  >charCodeAt</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193256"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns a number indicating the Unicode value of the character at the given index.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193261"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196678"  >concat</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193263"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Combines the text of two strings and returns a new string.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193268"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196715"  >fixed</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193270"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed in fixed-pitch font as if it were in a <FONT FACE="courier, couriernew, monospaced size">TT</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193275"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196753"  >fontcolor</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193277"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed in the specified color as if it were in a <FONT FACE="courier, couriernew, monospaced size">&lt;FONT COLOR=color&gt;</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193282"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196806"  >fontsize</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193284"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed in the specified font size as if it were in a <FONT FACE="courier, couriernew, monospaced size">&lt;FONT SIZE=size&gt;</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193289"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1225094"  >fromCharCode</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193292"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns a string created by using the specified sequence of Unicode values. This is a method on the String class, not on a String instance.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193297"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196895"  >indexOf</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193299"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the index within the calling <FONT FACE="courier, couriernew, monospaced size">String</FONT> object of the first occurrence of the specified value, or -1 if not found.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193304"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1196955"  >italics</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193306"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be italic, as if it were in an <FONT FACE="courier, couriernew, monospaced size">I</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193311"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1197005"  >lastIndexOf</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193313"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the index within the calling <FONT FACE="courier, couriernew, monospaced size">String</FONT> object of the last occurrence of the specified value, or -1 if not found.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193318"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1198070"  >link</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193320"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Creates an HTML hypertext link that requests another URL.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193325"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1205239"  >match</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193327"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Used to match a regular expression against a string.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193332"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194258"  >replace</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193334"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193339"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194332"  >search</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193341"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Executes the search for a match between a regular expression and a specified string.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193346"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194366"  >slice</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193348"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Extracts a section of a string and returns a new string. </ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193353"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194405"  >small</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193355"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed in a small font, as if it were in a <FONT FACE="courier, couriernew, monospaced size">SMALL</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193360"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194452"  >split</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193362"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Splits a <FONT FACE="courier, couriernew, monospaced size">String</FONT> object into an array of strings by separating the string into substrings.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193367"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194525"  >strike</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193369"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed as struck-out text, as if it were in a <FONT FACE="courier, couriernew, monospaced size">STRIKE</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193374"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194575"  >sub</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193376"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed as a subscript, as if it were in a <FONT FACE="courier, couriernew, monospaced size">SUB</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193381"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194618"  >substr</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193383"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the characters in a string beginning at the specified location through the specified number of characters.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193388"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194665"  >substring</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193390"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the characters in a string between two indexes into the string.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193395"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194721"  >sup</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193397"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Causes a string to be displayed as a superscript, as if it were in a <FONT FACE="courier, couriernew, monospaced size">SUP</FONT> tag.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193402"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194765"  >toLowerCase</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193405"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the calling string value converted to lowercase.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193410"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194796"  >toSource</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193412"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the <A HREF="object.html#1193320"  >Object.toSource</A> method.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1210567"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1210667"  >toString</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1210569"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns a string representing the specified object. Overrides the <A HREF="object.html#1193350"  >Object.toString</A> method.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193417"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1194823"  >toUpperCase</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193419"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the calling string value converted to uppercase.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1210650"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="string.html#1210732"  >valueOf</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1210652"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the primitive value of the specified object. Overrides the <A HREF="object.html#1193540"  >Object.valueOf</A> method.</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><A NAME="1214335"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>In addition, this object inherits the <A HREF="object.html#1193628"  >watch</A> and <A HREF="object.html#1193499"  >unwatch</A> methods from <A HREF="object.html#1193136"  >Object</A>.</zparagraph></FONT><P><BR><A NAME="1193421"> </A><A NAME="Examples"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Examples</zrefheader></B></FONT><BR><A NAME="1193422"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><B>Example 1: String literal.</B> The following statement creates a string literal:</zparagraph></FONT><P><A NAME="1193423"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>var last_name = "Schaefer"</zcodeline></FONT><P><A NAME="1193424"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><B>Example 2: String literal properties.</B> The following statements evaluate to 8, <FONT FACE="courier, couriernew, monospaced size">"SCHAEFER,"</FONT> and <FONT FACE="courier, couriernew, monospaced size">"schaefer"</FONT>:</zparagraph></FONT><P><A NAME="1193425"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>last_name.length<br>last_name.toUpperCase()<br>last_name.toLowerCase()</zcodeline></FONT><P><A NAME="1193426"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><B>Example 3: Accessing individual characters in a string.</B> You can think of a string as an array of characters. In this way, you can access the individual characters in the string by indexing that array. For example, the following code displays "The first character in the string is H":</zparagraph></FONT><P><A NAME="1193427"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>var myString = "Hello"<br>myString[0] // returns "H"</zcodeline></FONT><P><A NAME="1193429"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><B>Example 4: Pass a string among scripts in different windows or frames.</B> The following code creates two string variables and opens a second window:</zparagraph></FONT><P><A NAME="1193430"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>var lastName = "Schaefer"<br>var firstName = "Jesse"<br>empWindow=window.open('string2.html','window1','width=300,height=300')</zcodeline></FONT><P><A NAME="1193431"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>If the HTML source for the second window (<FONT FACE="courier, couriernew, monospaced size">string2.html</FONT>) creates two string variables, <FONT FACE="courier, couriernew, monospaced size">empLastName</FONT> and <FONT FACE="courier, couriernew, monospaced size">empFirstName</FONT>, the following code in the first window assigns values to the second window's variables:</zparagraph></FONT><P><A NAME="1193432"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>empWindow.empFirstName=firstName<br>empWindow.empLastName=lastName</zcodeline></FONT><P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -