Java String Index Of getNewlineIndexes(String src)

Here you can find the source of getNewlineIndexes(String src)

Description

get Newline Indexes

License

Open Source License

Declaration

public static int[] getNewlineIndexes(String src) 

Method Source Code


//package com.java2s;
import java.util.ArrayList;

public class Main {
    public static int[] getNewlineIndexes(String src) {
        ArrayList<Integer> indexes = new ArrayList<>();

        int cur = 0;

        while ((cur = src.indexOf("\n", cur) + 1) - 1 != -1 && !(src.replace("\\s+", "")).isEmpty()) {
            indexes.add(cur);//  ww  w .j a v a  2 s .c  o  m
        }

        return indexes.stream().mapToInt(i -> i).toArray();
    }
}

Related

  1. getIndexOrConstraintName(String command)
  2. getIndexString(T array, String indexPrefix, String separatorPrefix)
  3. getLowerBoundsOfAllStrings(int length, int seedIndex, int routeLength)
  4. getMatchingIndexes(final String source, final String match)
  5. getMergedLine(String lineOne, String lineTwo, int insertingIndex)
  6. getOffspringStrings(int startIndex, String treeStr)
  7. getPDFEncodingIndex(String key)
  8. getReplaceIndexes(String input, int startIndex, Stack replaceStack)
  9. getStructValue(String struct, int index)