Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. public ArrayList<String> check(ArrayList<String> result, String[] tokens, int begin, int end) {
  2. String message = "";
  3.  
  4. System.out.println("BEGIN-> "+begin+" END-> "+end);
  5.  
  6. for(int i=begin; i<=end; i++) {
  7. if(Character.isUpperCase(tokens[i].charAt(0))) {
  8. message += tokens[i]+" ";
  9. }
  10. }
  11.  
  12. //Remove spaces at the end
  13. message = message.trim();
  14.  
  15. for(int i=0; i<result.size(); i++) {
  16. //The biggest name IS in the array
  17. if(result.get(i).toLowerCase().contains(message.toLowerCase())) {
  18. return result;
  19. }
  20.  
  21. //The biggest name IS NOT in the array
  22. if(message.toLowerCase().contains(result.get(i).toLowerCase())) {
  23. result.set(i, message);
  24. return result;
  25. }
  26. }
  27.  
  28. result.add(message);
  29.  
  30. return result;
  31. }
  32.  
  33. public String[] checkForActor(String[] caracters, String[] actors) {
  34. ArrayList<String> c = new ArrayList<>();
  35.  
  36. for(String str : caracters) {
  37. c.add(str);
  38. }
  39.  
  40.  
  41. for(String actor: actors) {
  42. if(c.contains(actor)) {
  43. c.remove(actor);
  44. }
  45. }
  46.  
  47. String[] ret = new String[c.size()];
  48.  
  49. for(int i=0; i<c.size(); i++) {
  50. ret[i] = c.get(i);
  51. }
  52.  
  53. return ret;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement