Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //lolwut
- public int findString(String str, int start)
- {
- int notGood = 0;
- for (int i = start; i < line.length(); i++)
- {
- if (line.substring(i , i + 1).equals(str))
- {
- if (i == line.length() - 1 && notGood == 0)
- return i;
- else if (i == line.length() - 1)
- return -1;
- if (line.substring(i + 1 , i + 2).equals(str) && notGood == 0)
- return i;
- else
- notGood = 1;
- }
- else
- notGood = 0;
- }
- return -1;
- }
- private int countString(String str)
- {
- int counter = 0;
- int psn = 0;
- while (psn >= 0)
- {
- psn = line.indexOf(str , psn);
- if (psn >= 0)
- {
- psn++;
- counter++;
- }
- }
- return counter;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement