Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String one = (this.brown.substring(i, i+str.length())).toLowerCase();
- String two = str.toLowerCase();
- if (one.equals(two))
- {
- if (this.brown.substring(i+str.length(), i+str.length()+1).equals(" ") || // Checks that char. after word
- this.brown.substring(i+str.length(), i+str.length()+1).equals(".")) // Is a space
- {
- if (i > 0) // Used to avoid out of bounds error
- {
- if (this.brown.substring(i-1,i).equals(" ")) // Checks that char. before word is a space
- {
- count++;
- }
- }
- else if (i == 0)
- {
- count++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement