Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

searching a string with indexOf(

843805May 5 2007 — edited May 18 2007
I have a string of text that I'm trying to locate the periods, so I do string.indexOf("."); to get the index value. It returns to correct position when the text looks like this:
The cat is here.
but the index is off by one when the text looks like this:
The cat is here
.
Every time when I space it down the index returned is thrown off, what should I do?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2007
Added on May 5 2007
5 comments
350 views