Advertisement
Guest User

html a palindromy

a guest
Nov 24th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1.   public static List<String> vratPalindromyEasy(String text){
  2.       List<String> palindromy = new ArrayList<String>();
  3.       text = text.toLowerCase();
  4.      
  5.       for (String slovo: text.split(" ")){       
  6.           if(slovo.length()>1){
  7.               String reverse_mod = new StringBuffer(slovo).reverse().toString();             
  8.               if(slovo.equals(reverse_mod)){
  9.                   palindromy.add(slovo);
  10.               }            
  11.           }
  12.       }
  13.      
  14.       return palindromy;
  15.   }
  16.  
  17.   public static List<String> vratOdkaz(){
  18.       List<String> odkazy = new ArrayList<String>();
  19.          
  20.       Html kod = new Html();
  21.       String html = kod.toString();
  22.       Pattern p = Pattern.compile("<a href=.*?>");
  23.       Matcher m = p.matcher(html);
  24.      
  25.       while (m.find()) {
  26.           odkazy.add(html.substring(m.start(), m.end()));        
  27.       }
  28.          
  29.       return odkazy;
  30.      
  31.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement