subVirus?
I merged your two topics and marked the original one as un-solved.
Oops, made a few logical errors in my solution a few posts back.
public static int substring(String str1, String str2)
{
if (str2.length() > str1.length())
{
return 0;
}
for (int i = 0; i + str2.length() <= str1.length(); i++)
{
if (str2.equals(str1.substring(i, i + str2.length())))
{
return 1;
}
}
for (int i = str1.length() - str2.length() + 1; i < str1.length(); i++)
{
if (str2.equals(str1.substring(i, str1.length()) + str1.substring(
0, i - str2.length() + str1.length())))
{
return -1;
}
}
return 0;
}