this problem is harder than you probably think it is.
read up on string searching. some good algorithms are: knuth-morris-pratt, boyer-moore, and rabin-karp. these are pretty advanced.
a simpler way would be to use brute force. i personally wouldn't do this, but it sounds like you're desperate and / or have no idea what you're doing here. it's very easy, very inefficent, and very stupid.
Code:
int bruteForceSearch(String str, String pattern) {
for (int i = 0; int j = 0; j < pattern.length() && i < str.length(); i++, j++) {
if ( str[i] != pattern[j]) {
i -= j - 1;
j = -1;
}
}
if ( j == pattern.length() )
return i - pattern.length();
else
return i;
}
if i and j match, they are incremented, otherwise j is reset (to start from the beggining of the pattern), and i is set to move where we start looking over one.
when we get out of the loop, if j has moved through the entire pattern, it's in there, so we return where it is. if not, we return the length of the string to indicate we went all the way through and didn't find anything.
now could use this algorithm, but this requires that you have a pattern to search for. so you could also have a function to build all possible substrings of the string recursively, and check each pattern. also, if the pattern occurs more than once, you're screwed unless you modify that to keep track of how many times / where it is located.
that should get you started. good luck.
look at knuth-morris-pratt, it's pretty cool.