Purchase Solution

Using Java Class to Find a String in Another String

Not what you're looking for?

Ask Custom Question

How to use Java classes to find the number of times a string is present in another string?

Write a function to count occurrences of a string in another string. Then write a driver program to input a string and then input several lines of text, using the function to count occurrences of the string in the lines of text.

Purchase this Solution

Solution Summary

The attached class file demonstrates how to count the occurrences of one string in another string. Using this Java code, it is possible to input a string from a file and then find the number of times one string occurs in another. The solution is provided in JAVA and .txt (Notepad) file is also included.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Javscript Basics

Quiz on basics of javascript programming language.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.