Guest User

Untitled

a guest
Jun 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1.             String strValue = "basics in programming";
  2.        
  3.         int lastIndex = 0;
  4.         int counter = -1;
  5.         while( lastIndex != -1 ){
  6.             lastIndex = strValue.indexOf( "i", lastIndex + 1  );
  7.             counter++;
  8.             System.out.println( lastIndex );
  9.         }
  10.         System.out.println("number of i in statement " + counter );
Add Comment
Please, Sign In to add comment