about | help | code help+videos | done | prefs |
countString2
Given a string, return the number of times that String b appears in String a. Do not count overlapping occurrences. For example, the string "xx" occurs only once in "xxx" but twice in "xxxx". For this problem please use a while loop and the indexOf method. countString2("amy adams adds", "a") → 4 countString2("amy adams adds", "ad") → 2 countString2("eeee", "ee") → 2 ...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: 200
Copyright Nick Parlante 2017 - privacy