Java Array Replace arrayReplace(String haystack, String[] search, String[] replacements)

Here you can find the source of arrayReplace(String haystack, String[] search, String[] replacements)

Description

array Replace

License

Open Source License

Declaration

public static String arrayReplace(String haystack, String[] search, String[] replacements) 

Method Source Code

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

public class Main {
    public static String arrayReplace(String haystack, String[] search, String[] replacements) {
        String toReturn = haystack;
        for (int i = 0; i < search.length; i++) {
            toReturn = toReturn.replace(search[i], replacements[i]);
        }/*from w  w  w .  j  ava  2 s . c o  m*/
        return toReturn;
    }
}

Related

  1. replace(char[] array, char[] toBeReplaced, char[] replacementChars)
  2. replace(char[][] arrays, char character, char[][] replacements)
  3. replace(char[][] arrays, char character, char[][] replacements)
  4. replaceAll(final Object[] objs, final String str)