Answers for "how to find all occurances of substring in string in java"

0

find number of occurrences of a substring in a string java

public static int count(String str, String target) {
    return (str.length() - str.replace(target, "").length()) / target.length();
}
Posted by: Guest on October-29-2020

Code answers related to "how to find all occurances of substring in string in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language