Java Utililty Methods String Array Merge

List of utility methods to do String Array Merge

Description

The list of methods to do String Array Merge are organized into topic(s).

Method

String[]mergeString(String[] str1, String[] str2)
merge String
String[] merged = new String[str1.length + str2.length];
for (int i = 0; i < str1.length; i++) {
    merged[i] = str1[i];
for (int i = 0; i < str2.length; i++) {
    merged[i + str1.length] = str2[0];
return merged;
...
StringmergeStrings(Object... strings)
merge Strings
StringBuilder sb = new StringBuilder(500);
for (Object str : strings) {
    sb.append(str.toString());
return sb.toString();
StringmergeStrings(String s1, String s2)
merge s2 into s1 at position of first '$'
int pos = s1.indexOf('$');
if (pos == -1)
    return s1;
else
    return s1.substring(0, pos) + s2 + s1.substring(pos + 1);
String[]mergeStrings(String[] str1, String str1Tag, String[] str2)
This function will take a string array in str1, and it will insert the string array in str2 into it, with the first line of str2 being inserted where the str1Tag is located in str1.
String[] finalStr = new String[str1.length + str2.length - 1];
int fCtr = 0;
int s = 0;
for (int i = 0; i < str1.length; i++) {
    s = str1[i].indexOf(str1Tag);
    if (s != -1) {
        finalStr[fCtr] = str1[i].substring(0, s) + " " + str2[0];
        fCtr++;
...
StringmergeStringsFormatted(String[] strings, String spacer)
merge Strings Formatted
StringBuilder builder = new StringBuilder(strings.length);
for (String str : strings) {
    builder.append(spacer);
    builder.append(str);
    builder.append("\n");
return builder.toString();