src/java.base/share/classes/java/lang/String.java
changeset 58242 94bb65cb37d3
parent 57956 e0b8b019d2f5
child 58679 9c3209ff7550
child 58713 ad69fd32778e
equal deleted inserted replaced
58241:33de7752835c 58242:94bb65cb37d3
   700      * value is returned.
   700      * value is returned.
   701      *
   701      *
   702      * @param      index   the index of the {@code char} value.
   702      * @param      index   the index of the {@code char} value.
   703      * @return     the {@code char} value at the specified index of this string.
   703      * @return     the {@code char} value at the specified index of this string.
   704      *             The first {@code char} value is at index {@code 0}.
   704      *             The first {@code char} value is at index {@code 0}.
   705      * @exception  IndexOutOfBoundsException  if the {@code index}
   705      * @throws     IndexOutOfBoundsException  if the {@code index}
   706      *             argument is negative or not less than the length of this
   706      *             argument is negative or not less than the length of this
   707      *             string.
   707      *             string.
   708      */
   708      */
   709     public char charAt(int index) {
   709     public char charAt(int index) {
   710         if (isLatin1()) {
   710         if (isLatin1()) {
   729      * the {@code char} value at the given index is returned.
   729      * the {@code char} value at the given index is returned.
   730      *
   730      *
   731      * @param      index the index to the {@code char} values
   731      * @param      index the index to the {@code char} values
   732      * @return     the code point value of the character at the
   732      * @return     the code point value of the character at the
   733      *             {@code index}
   733      *             {@code index}
   734      * @exception  IndexOutOfBoundsException  if the {@code index}
   734      * @throws     IndexOutOfBoundsException  if the {@code index}
   735      *             argument is negative or not less than the length of this
   735      *             argument is negative or not less than the length of this
   736      *             string.
   736      *             string.
   737      * @since      1.5
   737      * @since      1.5
   738      */
   738      */
   739     public int codePointAt(int index) {
   739     public int codePointAt(int index) {
   761      * 1} is an unpaired low-surrogate or a high-surrogate, the
   761      * 1} is an unpaired low-surrogate or a high-surrogate, the
   762      * surrogate value is returned.
   762      * surrogate value is returned.
   763      *
   763      *
   764      * @param     index the index following the code point that should be returned
   764      * @param     index the index following the code point that should be returned
   765      * @return    the Unicode code point value before the given index.
   765      * @return    the Unicode code point value before the given index.
   766      * @exception IndexOutOfBoundsException if the {@code index}
   766      * @throws    IndexOutOfBoundsException if the {@code index}
   767      *            argument is less than 1 or greater than the length
   767      *            argument is less than 1 or greater than the length
   768      *            of this string.
   768      *            of this string.
   769      * @since     1.5
   769      * @since     1.5
   770      */
   770      */
   771     public int codePointBefore(int index) {
   771     public int codePointBefore(int index) {
   792      * the text range.
   792      * the text range.
   793      * @param endIndex the index after the last {@code char} of
   793      * @param endIndex the index after the last {@code char} of
   794      * the text range.
   794      * the text range.
   795      * @return the number of Unicode code points in the specified text
   795      * @return the number of Unicode code points in the specified text
   796      * range
   796      * range
   797      * @exception IndexOutOfBoundsException if the
   797      * @throws    IndexOutOfBoundsException if the
   798      * {@code beginIndex} is negative, or {@code endIndex}
   798      * {@code beginIndex} is negative, or {@code endIndex}
   799      * is larger than the length of this {@code String}, or
   799      * is larger than the length of this {@code String}, or
   800      * {@code beginIndex} is larger than {@code endIndex}.
   800      * {@code beginIndex} is larger than {@code endIndex}.
   801      * @since  1.5
   801      * @since  1.5
   802      */
   802      */
   819      * {@code codePointOffset} count as one code point each.
   819      * {@code codePointOffset} count as one code point each.
   820      *
   820      *
   821      * @param index the index to be offset
   821      * @param index the index to be offset
   822      * @param codePointOffset the offset in code points
   822      * @param codePointOffset the offset in code points
   823      * @return the index within this {@code String}
   823      * @return the index within this {@code String}
   824      * @exception IndexOutOfBoundsException if {@code index}
   824      * @throws    IndexOutOfBoundsException if {@code index}
   825      *   is negative or larger then the length of this
   825      *   is negative or larger then the length of this
   826      *   {@code String}, or if {@code codePointOffset} is positive
   826      *   {@code String}, or if {@code codePointOffset} is positive
   827      *   and the substring starting with {@code index} has fewer
   827      *   and the substring starting with {@code index} has fewer
   828      *   than {@code codePointOffset} code points,
   828      *   than {@code codePointOffset} code points,
   829      *   or if {@code codePointOffset} is negative and the substring
   829      *   or if {@code codePointOffset} is negative and the substring
   856      *                        to copy.
   856      *                        to copy.
   857      * @param      srcEnd     index after the last character in the string
   857      * @param      srcEnd     index after the last character in the string
   858      *                        to copy.
   858      *                        to copy.
   859      * @param      dst        the destination array.
   859      * @param      dst        the destination array.
   860      * @param      dstBegin   the start offset in the destination array.
   860      * @param      dstBegin   the start offset in the destination array.
   861      * @exception IndexOutOfBoundsException If any of the following
   861      * @throws    IndexOutOfBoundsException If any of the following
   862      *            is true:
   862      *            is true:
   863      *            <ul><li>{@code srcBegin} is negative.
   863      *            <ul><li>{@code srcBegin} is negative.
   864      *            <li>{@code srcBegin} is greater than {@code srcEnd}
   864      *            <li>{@code srcBegin} is greater than {@code srcEnd}
   865      *            <li>{@code srcEnd} is greater than the length of this
   865      *            <li>{@code srcEnd} is greater than the length of this
   866      *                string
   866      *                string
  1865      * "emptiness".substring(9) returns "" (an empty string)
  1865      * "emptiness".substring(9) returns "" (an empty string)
  1866      * </pre></blockquote>
  1866      * </pre></blockquote>
  1867      *
  1867      *
  1868      * @param      beginIndex   the beginning index, inclusive.
  1868      * @param      beginIndex   the beginning index, inclusive.
  1869      * @return     the specified substring.
  1869      * @return     the specified substring.
  1870      * @exception  IndexOutOfBoundsException  if
  1870      * @throws     IndexOutOfBoundsException  if
  1871      *             {@code beginIndex} is negative or larger than the
  1871      *             {@code beginIndex} is negative or larger than the
  1872      *             length of this {@code String} object.
  1872      *             length of this {@code String} object.
  1873      */
  1873      */
  1874     public String substring(int beginIndex) {
  1874     public String substring(int beginIndex) {
  1875         return substring(beginIndex, length());
  1875         return substring(beginIndex, length());
  1888      * </pre></blockquote>
  1888      * </pre></blockquote>
  1889      *
  1889      *
  1890      * @param      beginIndex   the beginning index, inclusive.
  1890      * @param      beginIndex   the beginning index, inclusive.
  1891      * @param      endIndex     the ending index, exclusive.
  1891      * @param      endIndex     the ending index, exclusive.
  1892      * @return     the specified substring.
  1892      * @return     the specified substring.
  1893      * @exception  IndexOutOfBoundsException  if the
  1893      * @throws     IndexOutOfBoundsException  if the
  1894      *             {@code beginIndex} is negative, or
  1894      *             {@code beginIndex} is negative, or
  1895      *             {@code endIndex} is larger than the length of
  1895      *             {@code endIndex} is larger than the length of
  1896      *             this {@code String} object, or
  1896      *             this {@code String} object, or
  1897      *             {@code beginIndex} is larger than
  1897      *             {@code beginIndex} is larger than
  1898      *             {@code endIndex}.
  1898      *             {@code endIndex}.
  3372      * @param   data     the character array.
  3372      * @param   data     the character array.
  3373      * @param   offset   initial offset of the subarray.
  3373      * @param   offset   initial offset of the subarray.
  3374      * @param   count    length of the subarray.
  3374      * @param   count    length of the subarray.
  3375      * @return  a {@code String} that contains the characters of the
  3375      * @return  a {@code String} that contains the characters of the
  3376      *          specified subarray of the character array.
  3376      *          specified subarray of the character array.
  3377      * @exception IndexOutOfBoundsException if {@code offset} is
  3377      * @throws    IndexOutOfBoundsException if {@code offset} is
  3378      *          negative, or {@code count} is negative, or
  3378      *          negative, or {@code count} is negative, or
  3379      *          {@code offset+count} is larger than
  3379      *          {@code offset+count} is larger than
  3380      *          {@code data.length}.
  3380      *          {@code data.length}.
  3381      */
  3381      */
  3382     public static String valueOf(char data[], int offset, int count) {
  3382     public static String valueOf(char data[], int offset, int count) {
  3389      * @param   data     the character array.
  3389      * @param   data     the character array.
  3390      * @param   offset   initial offset of the subarray.
  3390      * @param   offset   initial offset of the subarray.
  3391      * @param   count    length of the subarray.
  3391      * @param   count    length of the subarray.
  3392      * @return  a {@code String} that contains the characters of the
  3392      * @return  a {@code String} that contains the characters of the
  3393      *          specified subarray of the character array.
  3393      *          specified subarray of the character array.
  3394      * @exception IndexOutOfBoundsException if {@code offset} is
  3394      * @throws    IndexOutOfBoundsException if {@code offset} is
  3395      *          negative, or {@code count} is negative, or
  3395      *          negative, or {@code count} is negative, or
  3396      *          {@code offset+count} is larger than
  3396      *          {@code offset+count} is larger than
  3397      *          {@code data.length}.
  3397      *          {@code data.length}.
  3398      */
  3398      */
  3399     public static String copyValueOf(char data[], int offset, int count) {
  3399     public static String copyValueOf(char data[], int offset, int count) {