Java String Sub String substring(String str, int index, int length)

Here you can find the source of substring(String str, int index, int length)

Description

substring

License

Open Source License

Declaration

public static String substring(String str, int index, int length) 

Method Source Code

//package com.java2s;

public class Main {

    public static String substring(String str, int index, int length) {
        if (str == null) {
            return null;
        }/*from ww  w  . ja  va  2s  .c  om*/
        int len = str.length();
        if (index + length > len) {
            length = len - index;
        }
        return str.substring(index, length);
    }
}

Related

  1. subString(String str, int beginIndex, int endIndex)
  2. substring(String str, int beginIndex, int endIndex)
  3. substring(String str, int beginIndex, int endIndex)
  4. substring(String str, int beginIndex, int len)
  5. subString(String str, int end)
  6. subString(String str, int len)
  7. substring(String str, int len)
  8. subString(String str, int num, String token)
  9. substring(String str, int off, int len)