about | help | code help+videos | done | prefs |
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. HINT Strings have a method called indexOf() which you should use here. Specifically you want the overload with two parameters, which searches for something starting at some location. The two-parameter overload is no longer required knowledge on the AP exam (the one-parameter version only is required), but it's really useful.public int indexOf(String str, int fromIndex) apcsaStringsOccurrenceAfter("s", "s", 0) → 0 apcsaStringsOccurrenceAfter("s", "b", 0) → -1 apcsaStringsOccurrenceAfter("The quick brown fox jumps over the lazy dog", "quick", 20) → -1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 130
Copyright Nick Parlante 2017 - privacy