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

📄 string.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<A NAME="String(char[], int, int)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(char[]&nbsp;value,              int&nbsp;offset,              int&nbsp;count)</PRE><DL><DD>Allocates a new <code>String</code> that contains characters from  a subarray of the character array argument. The <code>offset</code>  argument is the index of the first character of the subarray and  the <code>count</code> argument specifies the length of the  subarray. The contents of the subarray are copied; subsequent  modification of the character array does not affect the newly  created string.<DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - array that is the source of characters.<DD><CODE>offset</CODE> - the initial offset.<DD><CODE>count</CODE> - the length.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the <code>offset</code>               and <code>count</code> arguments index characters outside               the bounds of the <code>value</code> array.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>value</code> is                <code>null</code>.</DL></DD></DL><HR><A NAME="String(byte[], int, int, int)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(byte[]&nbsp;ascii,              int&nbsp;hibyte,              int&nbsp;offset,              int&nbsp;count)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This method does not properly convert bytes into characters. As of JDK&nbsp;1.1, the preferred way to do this is via the <code>String</code> constructors that take a character-encoding name or that use the platform's default encoding.</I><P><DD>Allocates a new <code>String</code> constructed from a subarray  of an array of 8-bit integer values.  <p> The <code>offset</code> argument is the index of the first byte  of the subarray, and the <code>count</code> argument specifies the  length of the subarray.  <p> Each <code>byte</code> in the subarray is converted to a  <code>char</code> as specified in the method above.<DD><DL><DT><B>Parameters:</B><DD><CODE>ascii</CODE> - the bytes to be converted to characters.<DD><CODE>hibyte</CODE> - the top 8 bits of each 16-bit Unicode character.<DD><CODE>offset</CODE> - the initial offset.<DD><CODE>count</CODE> - the length.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the <code>offset</code>               or <code>count</code> argument is invalid.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>ascii</code> is                        <code>null</code>.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#String(byte[], int)"><CODE>String(byte[], int)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)"><CODE>String(byte[], int, int, java.lang.String)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[], int, int)"><CODE>String(byte[], int, int)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[], java.lang.String)"><CODE>String(byte[], java.lang.String)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[])"><CODE>String(byte[])</CODE></A></DL></DD></DL><HR><A NAME="String(byte[], int)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(byte[]&nbsp;ascii,              int&nbsp;hibyte)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This method does not properly convert bytes into characters. As of JDK&nbsp;1.1, the preferred way to do this is via the <code>String</code> constructors that take a character-encoding name or that use the platform's default encoding.</I><P><DD>Allocates a new <code>String</code> containing characters  constructed from an array of 8-bit integer values. Each character  <i>c</i>in the resulting string is constructed from the  corresponding component <i>b</i> in the byte array such that: <p><blockquote><pre>     <b><i>c</i></b> == (char)(((hibyte &amp; 0xff) &lt;&lt; 8)                         | (<b><i>b</i></b> &amp; 0xff)) </pre></blockquote><DD><DL><DT><B>Parameters:</B><DD><CODE>ascii</CODE> - the bytes to be converted to characters.<DD><CODE>hibyte</CODE> - the top 8 bits of each 16-bit Unicode character.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - If <code>ascii</code> is                       <code>null</code>.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#String(byte[], int, int, java.lang.String)"><CODE>String(byte[], int, int, java.lang.String)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[], int, int)"><CODE>String(byte[], int, int)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[], java.lang.String)"><CODE>String(byte[], java.lang.String)</CODE></A>, <A HREF="../../java/lang/String.html#String(byte[])"><CODE>String(byte[])</CODE></A></DL></DD></DL><HR><A NAME="String(byte[], int, int, java.lang.String)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(byte[]&nbsp;bytes,              int&nbsp;offset,              int&nbsp;length,              <A HREF="../../java/lang/String.html">String</A>&nbsp;enc)       throws <A HREF="../../java/io/UnsupportedEncodingException.html">UnsupportedEncodingException</A></PRE><DL><DD>Construct a new <code>String</code> by converting the specified subarray of bytes using the specified character encoding.  The length of the new <code>String</code> is a function of the encoding, and hence may not be equal to the length of the subarray.<DD><DL><DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be converted into characters<DD><CODE>offset</CODE> - Index of the first byte to convert<DD><CODE>length</CODE> - Number of bytes to convert<DD><CODE>enc</CODE> - The name of a supported                 <a href="package-summary.html#charenc">character                 encoding</a><DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html">UnsupportedEncodingException</A></CODE> - if the named encoding is not supported<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the <code>offset</code> and <code>count</code> arguments          index characters outside the bounds of the <code>value</code>          array.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="String(byte[], java.lang.String)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(byte[]&nbsp;bytes,              <A HREF="../../java/lang/String.html">String</A>&nbsp;enc)       throws <A HREF="../../java/io/UnsupportedEncodingException.html">UnsupportedEncodingException</A></PRE><DL><DD>Construct a new <code>String</code> by converting the specified array of bytes using the specified character encoding.  The length of the new <code>String</code> is a function of the encoding, and hence may not be equal to the length of the byte array.<DD><DL><DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be converted into characters<DD><CODE>enc</CODE> - The name of a supported                 <a href="package-summary.html#charenc">character                 encoding</a><DT><B>Throws:</B><DD><CODE><A HREF="../../java/io/UnsupportedEncodingException.html">UnsupportedEncodingException</A></CODE> - If the named encoding is not supported<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="String(byte[], int, int)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(byte[]&nbsp;bytes,              int&nbsp;offset,              int&nbsp;length)</PRE><DL><DD>Construct a new <code>String</code> by converting the specified subarray of bytes using the platform's default character encoding.  The length of the new <code>String</code> is a function of the encoding, and hence may not be equal to the length of the subarray.<DD><DL><DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be converted into characters<DD><CODE>offset</CODE> - Index of the first byte to convert<DD><CODE>length</CODE> - Number of bytes to convert<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="String(byte[])"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(byte[]&nbsp;bytes)</PRE><DL><DD>Construct a new <code>String</code> by converting the specified array of bytes using the platform's default character encoding.  The length of the new <code>String</code> is a function of the encoding, and hence may not be equal to the length of the byte array.<DD><DL><DT><B>Parameters:</B><DD><CODE>bytes</CODE> - The bytes to be converted into characters<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="String(java.lang.StringBuffer)"><!-- --></A><H3>String</H3><PRE>public <B>String</B>(<A HREF="../../java/lang/StringBuffer.html">StringBuffer</A>&nbsp;buffer)</PRE><DL><DD>Allocates a new string that contains the sequence of characters  currently contained in the string buffer argument. The contents of  the string buffer are copied; subsequent modification of the string  buffer does not affect the newly created string.<DD><DL><DT><B>Parameters:</B><DD><CODE>buffer</CODE> - a <code>StringBuffer</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - If <code>buffer</code> is  <code>null</code>.</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="length()"><!-- --></A><H3>length</H3><PRE>public int <B>length</B>()</PRE><DL><DD>Returns the length of this string. The length is equal to the number of 16-bit Unicode characters in the string.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the length of the sequence of characters represented by this          object.</DL></DD></DL><HR><A NAME="charAt(int)"><!-- --></A><H3>charAt</H3><PRE>public char <B>charAt</B>(int&nbsp;index)</PRE><DL><DD>Returns the character at the specified index. An index ranges from <code>0</code> to <code>length() - 1</code>. The first character  of the sequence is at index <code>0</code>, the next at index  <code>1</code>, and so on, as for array indexing.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the character.<DT><B>Returns:</B><DD>the character at the specified index of this string.             The first character is at index <code>0</code>.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the <code>index</code>              argument is negative or not less than the length of this              string.</DL></DD></DL><HR><A NAME="getChars(int, int, char[], int)"><!-- --></A><H3>getChars</H3><PRE>public void <B>getChars</B>(int&nbsp;srcBegin,                     int&nbsp;srcEnd,                     char[]&nbsp;dst,                     int&nbsp;dstBegin)</PRE><DL><DD>Copies characters from this string into the destination character  array.  <p> The first character to be copied is at index <code>srcBegin</code>;  the last character to be copied is at index <code>srcEnd-1</code>  (thus the total number of characters to be copied is  <code>srcEnd-srcBegin</code>). The characters are copied into the  subarray of <code>dst</code> starting at index <code>dstBegin</code>  and ending at index:  <p><blockquote><pre>     dstbegin + (srcEnd-srcBegin) - 1 </pre></blockquote><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>srcBegin</CODE> - index of the first character in the string                        to copy.<DD><CODE>srcEnd</CODE> - index after the last character in the string                        to copy.<DD><CODE>dst</CODE> - the destination array.<DD><CODE>dstBegin</CODE> - the start offset in the destination array.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - If any of the following             is true:            <ul><li><code>srcBegin</code> is negative.            <li><code>srcBegin</code> is greater than <code>srcEnd</code>            <li><code>srcEnd</code> is greater than the length of this                 string            <li><code>dstBegin</code> is negative            <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than                 <code>dst.length</code></ul><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>dst</code> is <code>null</code></DL></DD></DL><HR><A NAME="getBytes(int, int, byte[], int)"><!-- --></A><H3>getBytes</H3><PRE>public void <B>getBytes</B>(int&nbsp;srcBegin,                     int&nbsp;srcEnd,                     byte[]&nbsp;dst,

⌨️ 快捷键说明

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