Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************************
- * Kožusznik Jan
- * Copyright (c) 2014 All Right Reserved, http://www.kozusznik.cz
- *
- * This file is subject to the terms and conditions defined in
- * file 'LICENSE.txt', which is part of this source code package.
- ******************************************************************************/
- package $007_string_processing;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- /**
- * @author Jan Kožusznik
- * @version 0.1
- */
- public class Run07 {
- public static void main(String[] args) {
- Book b1 = new Book();
- String text = b1.toString();
- int counter = 0;
- for (int i = 0; i < text.length(); i++) {
- char pismeno = text.charAt(i);
- if(pismeno == 'a'){
- counter++;
- }
- }
- System.out.println(counter);
- int counter2 = 0;
- String text2 = text.toLowerCase();
- for(int i=0; i < text2.length(); i++){
- char pismeno2 = text2.charAt(i);
- if("aeiyou".indexOf(pismeno2) != -1){
- counter2++;
- }
- }
- System.out.println(counter2);
- System.out.println(text2.indexOf("stařec", 10));
- int counter3 = 0;
- int lastindex = 0;
- while(lastindex != -1){
- lastindex = text2.indexOf("stařec",lastindex);
- if(lastindex != -1){
- counter3++;
- lastindex+=1;
- }
- }
- System.out.println(counter3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement