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

📄 string.html

📁 是MIDP 的API 查詢文件, 大家可以看一下裡面的index.html, 再用Package 或 Class 名字來查.
💻 HTML
📖 第 1 页 / 共 5 页
字号:
 lexicographically precedes the argument string. The result is a positive integer if this <code>String</code> object lexicographically follows the argument string. The result is zero if the strings are equal; <code>compareTo</code> returns <code>0</code> exactly when the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method would return <code>true</code>. <p> This is the definition of lexicographic ordering. If two strings are different, then either they have different characters at some index that is a valid index for both strings, or their lengths are different, or both. If they have different characters at one or more index positions, let <i>k</i> be the smallest such index; then the string whose character at position <i>k</i> has the smaller value, as determined by using the < operator, lexicographically precedes the other string. In this case, <code>compareTo</code> returns the difference of the two character values at position <code>k</code> in the two string -- that is, the value: <blockquote><pre> this.charAt(k)-anotherString.charAt(k) </pre></blockquote> If there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case, <code>compareTo</code> returns the difference of the lengths of the strings -- that is, the value: <blockquote><pre> this.length()-anotherString.length() </pre></blockquote><DD><DL>
<DT><B>Parameters:</B><DD><CODE>anotherString</CODE> - the <code>String</code> to be compared.<DT><B>Returns:</B><DD>the value <code>0</code> if the argument string is equal to          this string; a value less than <code>0</code> if this string          is lexicographically less than the string argument; and a          value greater than <code>0</code> if this string is          lexicographically greater than the string argument.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>anotherString</code>          is <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="regionMatches(boolean, int, java.lang.String, int, int)"><!-- --></A><H3>
regionMatches</H3>
<PRE>
public boolean <B>regionMatches</B>(boolean&nbsp;ignoreCase,                             int&nbsp;toffset,                             <A HREF="../../java/lang/String.html">String</A>&nbsp;other,                             int&nbsp;ooffset,                             int&nbsp;len)</PRE>
<DL>
<DD>Tests if two string regions are equal. <p> A substring of this <tt>String</tt> object is compared to a substring of the argument <tt>other</tt>. The result is <tt>true</tt> if these substrings represent character sequences that are the same, ignoring case if and only if <tt>ignoreCase</tt> is true. The substring of this <tt>String</tt> object to be compared begins at index <tt>toffset</tt> and has length <tt>len</tt>. The substring of <tt>other</tt> to be compared begins at index <tt>ooffset</tt> and has length <tt>len</tt>. The result is <tt>false</tt> if and only if at least one of the following is true: <ul><li><tt>toffset</tt> is negative. <li><tt>ooffset</tt> is negative. <li><tt>toffset+len</tt> is greater than the length of this <tt>String</tt> object. <li><tt>ooffset+len</tt> is greater than the length of the other argument. <li>There is some nonnegative integer <i>k</i> less than <tt>len</tt> such that: <blockquote><pre> this.charAt(toffset+k) != other.charAt(ooffset+k) </pre></blockquote> <li><tt>ignoreCase</tt> is <tt>true</tt> and there is some nonnegative integer <i>k</i> less than <tt>len</tt> such that: <blockquote><pre> Character.toLowerCase(this.charAt(toffset+k)) !=Character.toLowerCase(other.charAt(ooffset+k)) </pre></blockquote> and: <blockquote><pre> Character.toUpperCase(this.charAt(toffset+k)) !=         Character.toUpperCase(other.charAt(ooffset+k)) </pre></blockquote> </ul><DD><DL>
<DT><B>Parameters:</B><DD><CODE>ignoreCase</CODE> - if <code>true</code>, ignore case when comparing                       characters.<DD><CODE>toffset</CODE> - the starting offset of the subregion in this                       string.<DD><CODE>other</CODE> - the string argument.<DD><CODE>ooffset</CODE> - the starting offset of the subregion in the string                       argument.<DD><CODE>len</CODE> - the number of characters to compare.<DT><B>Returns:</B><DD><code>true</code> if the specified subregion of this string          matches the specified subregion of the string argument;          <code>false</code> otherwise. Whether the matching is exact          or case insensitive depends on the <code>ignoreCase</code>          argument.</DL>
</DD>
</DL>
<HR>

<A NAME="startsWith(java.lang.String, int)"><!-- --></A><H3>
startsWith</H3>
<PRE>
public boolean <B>startsWith</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;prefix,                          int&nbsp;toffset)</PRE>
<DL>
<DD>Tests if this string starts with the specified prefix beginning a specified index.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>prefix</CODE> - the prefix.<DD><CODE>toffset</CODE> - where to begin looking in the string.<DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the          argument is a prefix of the substring of this object starting          at index <code>toffset</code>; <code>false</code> otherwise.          The result is <code>false</code> if <code>toffset</code> is          negative or greater than the length of this          <code>String</code> object; otherwise the result is the same          as the result of the expression          <pre>          this.subString(toffset).startsWith(prefix)          </pre><DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>prefix</code> is          <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="startsWith(java.lang.String)"><!-- --></A><H3>
startsWith</H3>
<PRE>
public boolean <B>startsWith</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;prefix)</PRE>
<DL>
<DD>Tests if this string starts with the specified prefix.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>prefix</CODE> - the prefix.<DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the          argument is a prefix of the character sequence represented by          this string; <code>false</code> otherwise.          Note also that <code>true</code> will be returned if the          argument is an empty string or is equal to this          <code>String</code> object as determined by the          <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>prefix</code> is          <code>null</code>.<DT><B>Since: </B><DD>JDK1. 0</DD>
</DL>
</DD>
</DL>
<HR>

<A NAME="endsWith(java.lang.String)"><!-- --></A><H3>
endsWith</H3>
<PRE>
public boolean <B>endsWith</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;suffix)</PRE>
<DL>
<DD>Tests if this string ends with the specified suffix.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>suffix</CODE> - the suffix.<DT><B>Returns:</B><DD><code>true</code> if the character sequence represented by the          argument is a suffix of the character sequence represented by          this object; <code>false</code> otherwise. Note that the          result will be <code>true</code> if the argument is the          empty string or is equal to this <code>String</code> object          as determined by the <A HREF="../../java/lang/String.html#equals(java.lang.Object)"><CODE>equals(Object)</CODE></A> method.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if <code>suffix</code> is          <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="hashCode()"><!-- --></A><H3>
hashCode</H3>
<PRE>
public int <B>hashCode</B>()</PRE>
<DL>
<DD>Returns a hashcode for this string. The hashcode for a <code>String</code> object is computed as <blockquote><pre> s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] </pre></blockquote> using <code>int</code> arithmetic, where <code>s[i]</code> is the <i>i</i>th character of the string, <code>n</code> is the length of the string, and <code>^</code> indicates exponentiation. (The hash value of the empty string is zero.)<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a hash code value for this object.</DL>
</DD>
</DL>
<HR>

<A NAME="indexOf(int)"><!-- --></A><H3>
indexOf</H3>
<PRE>
public int <B>indexOf</B>(int&nbsp;ch)</PRE>
<DL>
<DD>Returns the index within this string of the first occurrence of the specified character. If a character with value <code>ch</code> occurs in the character sequence represented by this <code>String</code> object, then the index of the first such occurrence is returned -- that is, the smallest value <i>k</i> such that: <blockquote><pre> this.charAt(<i>k</i>) == ch </pre></blockquote> is <code>true</code>. If no such character occurs in this string, then <code>-1</code> is returned.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character.<DT><B>Returns:</B><DD>the index of the first occurrence of the character in the          character sequence represented by this object, or          <code>-1</code> if the character does not occur.</DL>
</DD>
</DL>
<HR>

<A NAME="indexOf(int, int)"><!-- --></A><H3>
indexOf</H3>
<PRE>
public int <B>indexOf</B>(int&nbsp;ch,                   int&nbsp;fromIndex)</PRE>
<DL>
<DD>Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index. <p> If a character with value <code>ch</code> occurs in the character sequence represented by this <code>String</code> object at an index no smaller than <code>fromIndex</code>, then the index of the first such occurrence is returned--that is, the smallest value <i>k</i> such that: <blockquote><pre> (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex) </pre></blockquote> is true. If no such character occurs in this string at or after position <code>fromIndex</code>, then <code>-1</code> is returned. <p> There is no restriction on the value of <code>fromIndex</code>. If it is negative, it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string, it has the same effect as if it were equal to the length of this string: <code>-1</code> is returned.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character.<DD><CODE>fromIndex</CODE> - the index to start the search from.<DT><B>Returns:</B><DD>the index of the first occurrence of the character in the          character sequence represented by this object that is greater          than or equal to <code>fromIndex</code>, or <code>-1</code>          if the character does not occur.</DL>
</DD>
</DL>
<HR>

<A NAME="lastIndexOf(int)"><!-- --></A><H3>
lastIndexOf</H3>
<PRE>
public int <B>lastIndexOf</B>(int&nbsp;ch)</PRE>
<DL>
<DD>Returns the index within this string of the last occurrence of the specified character. That is, the index returned is the largest value <i>k</i> such that: <blockquote><pre> this.charAt(<i>k</i>) == ch </pre></blockquote> is true. The String is searched backwards starting at the last character.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character.<DT><B>Returns:</B><DD>the index of the last occurrence of the character in the          character sequence represented by this object, or          <code>-1</code> if the character does not occur.</DL>
</DD>
</DL>
<HR>

<A NAME="lastIndexOf(int, int)"><!-- --></A><H3>
lastIndexOf</H3>
<PRE>
public int <B>lastIndexOf</B>(int&nbsp;ch,                       int&nbsp;fromIndex)</PRE>
<DL>
<DD>Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index. That is, the index returned is the largest value <i>k</i> such that: <blockquote><pre> this.charAt(k) == ch) && (k <= fromIndex) </pre></blockquote> is true.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ch</CODE> - a character.<DD><CODE>fromIndex</CODE> - the index to start the search from. There is no          restriction on the value of <code>fromIndex</code>. If it is          greater than or equal to the length of this string, it has          the same effect as if it were equal to one less than the          length of this string: this entire string may be searched.          If it is negative, it has the same effect as if it were -1:          -1 is returned.<DT><B>Returns:</B><DD>the index of the last occurrence of the character in the          character sequence represented by this object that is less          than or equal to <code>fromIndex</code>, or <code>-1</code>          if the character does not occur before that point.</DL>
</DD>
</DL>
<HR>

⌨️ 快捷键说明

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