Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. String one = (this.brown.substring(i, i+str.length())).toLowerCase();
  2. String two = str.toLowerCase();
  3. if (one.equals(two))
  4. {
  5. if (this.brown.substring(i+str.length(), i+str.length()+1).equals(" ") || // Checks that char. after word
  6. this.brown.substring(i+str.length(), i+str.length()+1).equals(".")) // Is a space
  7. {
  8. if (i > 0) // Used to avoid out of bounds error
  9. {
  10. if (this.brown.substring(i-1,i).equals(" ")) // Checks that char. before word is a space
  11. {
  12. count++;
  13. }
  14. }
  15. else if (i == 0)
  16. {
  17. count++;
  18. }
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement