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

📄 string.html

📁 是MIDP 的API 查詢文件, 大家可以看一下裡面的index.html, 再用Package 或 Class 名字來查.
💻 HTML
📖 第 1 页 / 共 5 页
字号:

<A NAME="String()"><!-- --></A><H3>
String</H3>
<PRE>
public <B>String</B>()</PRE>
<DL>
<DD>Initializes a newly created <code>String</code> object so that it represents an empty character sequence.</DL>
<HR>

<A NAME="String(java.lang.String)"><!-- --></A><H3>
String</H3>
<PRE>
public <B>String</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;value)</PRE>
<DL>
<DD>Initializes a newly created <code>String</code> object so that it represents the same sequence of characters as the argument; in other words, the newly created string is a copy of the argument string.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - a <code>String</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="String(char[])"><!-- --></A><H3>
String</H3>
<PRE>
public <B>String</B>(char[]&nbsp;value)</PRE>
<DL>
<DD>Allocates a new <code>String</code> so that it represents the sequence of characters currently contained in the character array argument. The contents of the character array 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> - the initial value of the string.<DT><B>Throws:</B><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(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, java.lang.String)"><!-- --></A><H3>
String</H3>
<PRE>
public <B>String</B>(byte[]&nbsp;bytes,              int&nbsp;off,              int&nbsp;len,              <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>off</CODE> - Index of the first byte to convert<DD><CODE>len</CODE> - Number of bytes to convert<DD><CODE>enc</CODE> - The name of a character encoding<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[], 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 character encoding<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;off,              int&nbsp;len)</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>off</CODE> - Index of the first byte to convert<DD><CODE>len</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>
<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>
<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>
<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(java.lang.String)"><!-- --></A><H3>
getBytes</H3>
<PRE>
public byte[] <B>getBytes</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;enc)                throws <A HREF="../../java/io/UnsupportedEncodingException.html">UnsupportedEncodingException</A></PRE>
<DL>
<DD>Convert this <code>String</code> into bytes according to the specified character encoding, storing the result into a new byte array.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>enc</CODE> - A character-encoding name<DT><B>Returns:</B><DD>The resultant byte array<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="getBytes()"><!-- --></A><H3>
getBytes</H3>
<PRE>
public byte[] <B>getBytes</B>()</PRE>
<DL>
<DD>Convert this <code>String</code> into bytes according to the platform's default character encoding, storing the result into a new byte array.<DD><DL>
<DT><B>Returns:</B><DD>the resultant byte array.<DT><B>Since: </B><DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
equals</H3>
<PRE>
public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;anObject)</PRE>
<DL>
<DD>Compares this string to the specified object. The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>String</code> object that represents the same sequence of characters as this object.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>anObject</CODE> - the object to compare this <code>String</code>                     against.<DT><B>Returns:</B><DD><code>true</code> if the <code>String </code>are equal;          <code>false</code> otherwise.<DT><B>See Also: </B><DD><A HREF="../../java/lang/String.html#compareTo(java.lang.String)"><CODE>compareTo(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="compareTo(java.lang.String)"><!-- --></A><H3>
compareTo</H3>
<PRE>
public int <B>compareTo</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;anotherString)</PRE>
<DL>
<DD>Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this <code>String</code> object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this <code>String</code> object

⌨️ 快捷键说明

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