Java Array Replace replaceInArray(String[] thisArray, String findThis, String replaceWithThis)

Here you can find the source of replaceInArray(String[] thisArray, String findThis, String replaceWithThis)

Description

replace In Array

License

Open Source License

Declaration

public static String[] replaceInArray(String[] thisArray, String findThis, String replaceWithThis) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static String[] replaceInArray(String[] thisArray, String findThis, String replaceWithThis) {
        String[] outputArray = new String[thisArray.length];
        for (int i = 0; i < thisArray.length; i++) {
            outputArray[i] = thisArray[i].replaceAll(findThis, replaceWithThis);
        }//from   w w  w  .  j a  v a2 s  . c  om
        return outputArray;
    }

    public static ArrayList<String[]> replaceInArray(ArrayList<String[]> thisArrayList, String findThis,
            String replaceWithThis) {
        ArrayList<String[]> outputArrayList = new ArrayList<String[]>();
        for (int i = 0; i < thisArrayList.size(); i++) {
            outputArrayList.add(replaceInArray(thisArrayList.get(i), findThis, replaceWithThis));
        }
        return outputArrayList;
    }
}

Related

  1. replaceAll(final Object[] objs, final String str)
  2. replaceAll(final String[] args, final String from, final String to)
  3. replaceAll(String src, String[] replace, String[] by)
  4. replaceChars(String s, char[] from, char[] to)
  5. replaceIgnoreCase(final String s, final String[] sub, final String[] with)
  6. replaceWithValues(String subject, String needle, String[] values)