src/share/classes/java/lang/String.java

Print this page

        

*** 1669,1683 **** /** * Returns the index within this string of the first occurrence of the * specified substring. * ! * <p>The returned index is the smallest value <i>k</i> for which: ! * <blockquote><pre> ! * this.startsWith(str, <i>k</i>) ! * </pre></blockquote> ! * If no such value of <i>k</i> exists, then {@code -1} is returned. * * @param str the substring to search for. * @return the index of the first occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */ --- 1669,1683 ---- /** * Returns the index within this string of the first occurrence of the * specified substring. * ! * <p>The returned index is the smallest value {@code k} for which: ! * <pre>{@code ! * this.startsWith(str, k) ! * }</pre> ! * If no such value of {@code k} exists, then {@code -1} is returned. * * @param str the substring to search for. * @return the index of the first occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */
*** 1687,1701 **** /** * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. * ! * <p>The returned index is the smallest value <i>k</i> for which: ! * <blockquote><pre> ! * <i>k</i> &gt;= fromIndex {@code &&} this.startsWith(str, <i>k</i>) ! * </pre></blockquote> ! * If no such value of <i>k</i> exists, then {@code -1} is returned. * * @param str the substring to search for. * @param fromIndex the index from which to start the search. * @return the index of the first occurrence of the specified substring, * starting at the specified index, --- 1687,1702 ---- /** * Returns the index within this string of the first occurrence of the * specified substring, starting at the specified index. * ! * <p>The returned index is the smallest value {@code k} for which: ! * <pre>{@code ! * k >= Math.min(fromIndex, this.length()) && ! * this.startsWith(str, k) ! * }</pre> ! * If no such value of {@code k} exists, then {@code -1} is returned. * * @param str the substring to search for. * @param fromIndex the index from which to start the search. * @return the index of the first occurrence of the specified substring, * starting at the specified index,
*** 1778,1792 **** /** * Returns the index within this string of the last occurrence of the * specified substring. The last occurrence of the empty string "" * is considered to occur at the index value {@code this.length()}. * ! * <p>The returned index is the largest value <i>k</i> for which: ! * <blockquote><pre> ! * this.startsWith(str, <i>k</i>) ! * </pre></blockquote> ! * If no such value of <i>k</i> exists, then {@code -1} is returned. * * @param str the substring to search for. * @return the index of the last occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */ --- 1779,1793 ---- /** * Returns the index within this string of the last occurrence of the * specified substring. The last occurrence of the empty string "" * is considered to occur at the index value {@code this.length()}. * ! * <p>The returned index is the largest value {@code k} for which: ! * <pre>{@code ! * this.startsWith(str, k) ! * }</pre> ! * If no such value of {@code k} exists, then {@code -1} is returned. * * @param str the substring to search for. * @return the index of the last occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */
*** 1796,1810 **** /** * Returns the index within this string of the last occurrence of the * specified substring, searching backward starting at the specified index. * ! * <p>The returned index is the largest value <i>k</i> for which: ! * <blockquote><pre> ! * <i>k</i> {@code <=} fromIndex {@code &&} this.startsWith(str, <i>k</i>) ! * </pre></blockquote> ! * If no such value of <i>k</i> exists, then {@code -1} is returned. * * @param str the substring to search for. * @param fromIndex the index to start the search from. * @return the index of the last occurrence of the specified substring, * searching backward from the specified index, --- 1797,1812 ---- /** * Returns the index within this string of the last occurrence of the * specified substring, searching backward starting at the specified index. * ! * <p>The returned index is the largest value {@code k} for which: ! * <pre>{@code ! * k <= Math.min(fromIndex, this.length()) && ! * this.startsWith(str, k) ! * }</pre> ! * If no such value of {@code k} exists, then {@code -1} is returned. * * @param str the substring to search for. * @param fromIndex the index to start the search from. * @return the index of the last occurrence of the specified substring, * searching backward from the specified index,