Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static Scanner in = new Scanner(System.in);
- static int arraySize;
- static ArrayList<String> arrayPractice;
- public static String[] startWith(String s){
- String[] temp = new String[arraySize];
- int counter = 0;
- for(String c : arrayPractice){
- if(c.indexOf(s) == 1){
- temp[counter++] = c;
- }
- }
- return temp;
- }
- public static String[] endWith(String s){
- String[] temp = new String[arraySize];
- int counter = 0;
- for(String c : arrayPractice){
- if(c.indexOf(s) == c.length() - s.length()){
- temp[counter++] = c;
- }
- }
- return temp;
- }
- public static void replace(String word, int index){
- arrayPractice.set(index, word);
- }
- public static void toUpperCase(int index){
- arrayPractice.set(index, arrayPractice.get(index).toUpperCase());
- }
- public static void toLowerCase(int index){
- arrayPractice.set(index, arrayPractice.get(index).toLowerCase());
- }
- public static void firstLetterLower(){
- for(int i = 0; i < arrayPractice.size(); i++){
- String temp = arrayPractice.get(i).substring(0,1).toLowerCase() + arrayPractice.get(i).substring(1);
- arrayPractice.set(i, temp);
- }
- }
- public static void getInput(File f) throws FileNotFoundException
- {
- Scanner s = new Scanner(f);
- while(s.hasNext())
- {
- arrayPractice.add(s.nextLine());
- }
- }
- public static void firstLetterUpper(){
- for(int i = 0; i < arrayPractice.size(); i++){
- String temp = arrayPractice.get(i).substring(0,1).toUpperCase() + arrayPractice.get(i).substring(1);
- arrayPractice.set(i, temp);
- }
- }
- public static String concatenate(String word, int index){
- String temp = "";
- temp += word + arrayPractice.get(i);
- return temp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement