Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public static void main(String[] args) {
- String test = "AccountAccounts ssgs AccouAccount more Account";
- int count = 0;
- int beginAt = 0;
- int where;
- while ((where = test.indexOf("Account", beginAt)) != -1) {
- count++;
- beginAt = where + 1;
- }
- System.out.println(count); // 4
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment