Java String Sub String substr(String str, int startIndex, int length)

Here you can find the source of substr(String str, int startIndex, int length)

Description

substr

License

Open Source License

Declaration

public static String substr(String str, int startIndex, int length) 

Method Source Code

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

public class Main {

    public static String substr(String str, int startIndex, int length) {
        return substring(str, startIndex, startIndex + length);
    }/*from   w  w w . j a v a  2s .com*/

    public static String substring(String str, int startIndex, int endIndex) {
        startIndex = startIndex < 0 ? 0 : startIndex;
        endIndex = endIndex > str.length() ? str.length() : endIndex;
        if (startIndex < endIndex) {
            return "";
        }
        return str.substring(startIndex, endIndex);
    }
}

Related

  1. substr(String str, int index)
  2. subStr(String str, int len)
  3. substr(String str, int length)
  4. subStr(String str, int limit)
  5. subStr(String str, int maxLen)
  6. substr(String substr1, String substr2)
  7. substr(String what, int begin, int end)
  8. substr(StringBuffer buf)
  9. substract(double[] a, double[] b)