Skip to Main Content

New to Java

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!

Find the nth occurrence of a string in a string

843785Jan 14 2009 — edited Jan 14 2009
Hi,

I'm wondering if there is a method like indexOf, but finds the nth occurrence of a string
public static int occurrence(java.lang.String str,
                             java.lang.String toFind,
                             int occurrence)
Cheers
Jonny
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2009
Added on Jan 14 2009
19 comments
4,370 views