/[classpath]/classpath/java/lang/String.java
ViewVC logotype

Diff of /classpath/java/lang/String.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by mark, Tue Jan 22 22:27:00 2002 UTC revision 1.37 by mark, Fri Feb 15 12:08:15 2002 UTC
# Line 799  Character.toLowerCase(value[i]) == Chara Line 799  Character.toLowerCase(value[i]) == Chara
799     */     */
800    public int indexOf(String str, int fromIndex) throws NullPointerException {    public int indexOf(String str, int fromIndex) throws NullPointerException {
801      if (fromIndex < 0) fromIndex = 0;      if (fromIndex < 0) fromIndex = 0;
802      for (int i = fromIndex; i < count; i++)      for (int i = fromIndex; i <= count; i++)
803        if (regionMatches(i, str, 0, str.count))        if (regionMatches(i, str, 0, str.count))
804          return i;          return i;
805      return -1;      return -1;
# Line 846  Character.toLowerCase(value[i]) == Chara Line 846  Character.toLowerCase(value[i]) == Chara
846     * @exception NullPointerException if `str' is null     * @exception NullPointerException if `str' is null
847     */     */
848    public int lastIndexOf(String str) throws NullPointerException {    public int lastIndexOf(String str) throws NullPointerException {
849      return lastIndexOf(str, count-1);      return lastIndexOf(str, count-str.count);
850    }    }
851    
852    /**    /**
# Line 864  Character.toLowerCase(value[i]) == Chara Line 864  Character.toLowerCase(value[i]) == Chara
864     */     */
865    public int lastIndexOf(String str, int fromIndex)    public int lastIndexOf(String str, int fromIndex)
866      throws NullPointerException {      throws NullPointerException {
867      if (fromIndex > count)      if (fromIndex >= count)
868        fromIndex = count;        fromIndex = count - str.count;
869      for (int i = fromIndex; i >= 0; i--)      for (int i = fromIndex; i >= 0; i--)
870        if (regionMatches(i, str, 0, str.count))        if (regionMatches(i, str, 0, str.count))
871          return i;          return i;

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26