Java String Index Of readColumn(int columnIndex, String inputString, String columnSeparator)

Here you can find the source of readColumn(int columnIndex, String inputString, String columnSeparator)

Description

read Column

License

Open Source License

Declaration

public static List<String> readColumn(int columnIndex, String inputString, String columnSeparator) 

Method Source Code


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

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> readColumn(int columnIndex, String inputString, String columnSeparator) {
        List<String> columnValues = new ArrayList<String>();
        for (String line : inputString.split(System.getProperty("line.separator"))) {
            String[] columns = line.split(columnSeparator);
            if (columnIndex < columns.length) {
                columnValues.add(columns[columnIndex]);
            }//from   w w w .  j a v a  2  s  .c  o  m
        }
        return columnValues;

    }
}

Related

  1. indexOfWord(String word, String string)
  2. isPhaseGroupContainsPhase(int index, String phaseName)
  3. lastIndexOf(String pattern, String s)
  4. lastIndexOfIgnoreCase(final String s, final String subS)
  5. mergeStringLines(String lineOne, String lineTwo, int keyIndex, int insertingIndex)
  6. removeColumn(String line, int index)
  7. splitUsingIndexOf(String splittee, String splitter)
  8. sub(String string, int fromIndex, int toIndex)
  9. subStringChinese(String str, int startIndex, int endIndex)