forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice hcs-strings > hcsStringsOccurrenceAfter
prev  |  next  |  chance

Given a text and a search term (both Strings) as well as a starting index, find the index where the search term occurs within the text at or after the starting index. Return -1 if not found under these conditions.

hcsStringsOccurrenceAfter("s", "s", 0) → 0
hcsStringsOccurrenceAfter("s", "b", 0) → -1
hcsStringsOccurrenceAfter("The quick brown fox jumps over the lazy dog", "quick", 20) → -1

...Save, Compile, Run (ctrl-enter)

public int hcsStringsOccurrenceAfter(String text, String searchterm, int index) { }

Editor font size %:
Shorter output

Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 130 Post-solution available

Copyright Nick Parlante 2017 - privacy