Advertisement
Guest User

pay attention in class eli, this is the last time i'm helpin

a guest
May 4th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. static Scanner in = new Scanner(System.in);
  2. static int arraySize;
  3. static ArrayList<String> arrayPractice;
  4. public static String[] startWith(String s){
  5. String[] temp = new String[arraySize];
  6. int counter = 0;
  7. for(String c : arrayPractice){
  8. if(c.indexOf(s) == 1){
  9. temp[counter++] = c;
  10. }
  11. }
  12. return temp;
  13. }
  14. public static String[] endWith(String s){
  15. String[] temp = new String[arraySize];
  16. int counter = 0;
  17. for(String c : arrayPractice){
  18. if(c.indexOf(s) == c.length() - s.length()){
  19. temp[counter++] = c;
  20. }
  21. }
  22. return temp;
  23. }
  24. public static void replace(String word, int index){
  25. arrayPractice.set(index, word);
  26. }
  27. public static void toUpperCase(int index){
  28. arrayPractice.set(index, arrayPractice.get(index).toUpperCase());
  29. }
  30. public static void toLowerCase(int index){
  31. arrayPractice.set(index, arrayPractice.get(index).toLowerCase());
  32. }
  33. public static void firstLetterLower(){
  34. for(int i = 0; i < arrayPractice.size(); i++){
  35. String temp = arrayPractice.get(i).substring(0,1).toLowerCase() + arrayPractice.get(i).substring(1);
  36. arrayPractice.set(i, temp);
  37. }
  38. }
  39. public static void getInput(File f) throws FileNotFoundException
  40. {
  41. Scanner s = new Scanner(f);
  42. while(s.hasNext())
  43. {
  44. arrayPractice.add(s.nextLine());
  45. }
  46. }
  47. public static void firstLetterUpper(){
  48. for(int i = 0; i < arrayPractice.size(); i++){
  49. String temp = arrayPractice.get(i).substring(0,1).toUpperCase() + arrayPractice.get(i).substring(1);
  50. arrayPractice.set(i, temp);
  51. }
  52. }
  53. public static String concatenate(String word, int index){
  54. String temp = "";
  55. temp += word + arrayPractice.get(i);
  56. return temp;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement