Android String Split getLine(String text, int line)

Here you can find the source of getLine(String text, int line)

Description

get Line

Declaration

public static String getLine(String text, int line) 

Method Source Code

//package com.java2s;

public class Main {
    public static String getLine(String text, int line) {
        int tempPos, tempStart, tempEnd;
        for (int pos = 0; pos <= text.length();) {
            //Get the Start Offset
            tempStart = pos;//from w w  w.  j  a va  2  s .  co m

            //Get the End Offset
            tempPos = text.indexOf("\n", pos);
            if (tempPos == -1) {
                //No more lines
                //End Offset is the end of the string
                tempEnd = text.length();
                pos = tempEnd + 1;
            } else {
                //There is one more line
                tempEnd = tempPos;
                pos = tempEnd + 1;
            }
            //TODO: Add Android logging
            /*
            TestInfo.testWriteLn("-----------------");
            TestInfo.testWrite("Row: " + row);
            TestInfo.testWrite(" - Start: " + tempStart);
            TestInfo.testWriteLn(" - End: " + tempEnd);
             */
            //Write line
            if (tempStart == tempEnd) {
            } else {
            }
            //TODO: TestInfo.testWriteLn(strLine);
        }
        return "";
    }
}

Related

  1. splitLast(String target, String pattern)
  2. splitSteps(String str, String split)
  3. splitString(String tokenedStr, String token)
  4. explode(String original, String split)
  5. getFirstWord(String str)
  6. stringToLongArray(String src, String separator)
  7. strToArray(String string)
  8. strToArray(String string, String delim)
  9. getStringArray(String str)