Java String Index Of getMergedLine(String lineOne, String lineTwo, int insertingIndex)

Here you can find the source of getMergedLine(String lineOne, String lineTwo, int insertingIndex)

Description

get Merged Line

License

Open Source License

Declaration

static String getMergedLine(String lineOne, String lineTwo,
            int insertingIndex) 

Method Source Code

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

import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    static String getMergedLine(String lineOne, String lineTwo,
            int insertingIndex) {
        ArrayList<String> lstLineOne = new ArrayList<String>(
                Arrays.asList(lineOne.split(",")));
        ArrayList<String> lstLineTwo = new ArrayList<String>(
                Arrays.asList(lineTwo.split(",")));

        for (int i = 0; i < lstLineTwo.size(); i++) {
            lstLineOne.add(insertingIndex + i, lstLineTwo.get(i));
        }/*from   ww  w  . j  a  v  a 2  s . c o  m*/

        return strArrayListToString(lstLineOne);
    }

    static String strArrayListToString(ArrayList<String> lstLine) {
        String line = "";

        for (int i = 0; i < lstLine.size(); i++) {
            line = line + lstLine.get(i);

            if (i != lstLine.size() - 1)
                line = line + ",";
        }

        return line;
    }
}

Related

  1. getIndexOfChar(String str, String start, String end)
  2. getIndexOrConstraintName(String command)
  3. getIndexString(T array, String indexPrefix, String separatorPrefix)
  4. getLowerBoundsOfAllStrings(int length, int seedIndex, int routeLength)
  5. getMatchingIndexes(final String source, final String match)
  6. getNewlineIndexes(String src)
  7. getOffspringStrings(int startIndex, String treeStr)
  8. getPDFEncodingIndex(String key)
  9. getReplaceIndexes(String input, int startIndex, Stack replaceStack)