Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String strValue = "basics in programming";
- int lastIndex = 0;
- int counter = -1;
- while( lastIndex != -1 ){
- lastIndex = strValue.indexOf( "i", lastIndex + 1 );
- counter++;
- System.out.println( lastIndex );
- }
- System.out.println("number of i in statement " + counter );
Add Comment
Please, Sign In to add comment