id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

countPatternInString


Write a method which is given two Strings as input parameters. The method should return the count of how many times the second String is contained in the first String passed to the method. For example countPatternInString("banana","ana") should return 2.


countPatternInString("Mississippi", "iss") → 2
countPatternInString("banana", "ana") → 2
countPatternInString("Marlboro Mustangs", "Ma") → 1

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

public int countPatternInString(String str, String pattern){ }

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

Copyright Nick Parlante 2017 - privacy