Java String Sub String substring(char[] s, int start, int end)

Here you can find the source of substring(char[] s, int start, int end)

Description

substring

License

Open Source License

Declaration

public static char[] substring(char[] s, int start, int end) 

Method Source Code

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

public class Main {
    public static char[] substring(char[] s, int start, int end) {
        char[] result = new char[end - start];
        for (int i = 0; i < result.length; i++) {
            result[i] = s[start + i];/* w w w. j a  v  a 2 s.co m*/

        }

        return result;
    }

    public static byte[] substring(byte[] s, int start, int end) {
        byte[] result = new byte[end - start];
        for (int i = 0; i < result.length; i++)
            result[i] = s[start + i];

        return result;
    }

    public static char[] substring(String s, int start, int end) {
        return substring(s.toCharArray(), start, end);
    }
}

Related

  1. subStrBytes2(String str, int byteLength)
  2. substrCount(String haystack, String needle)
  3. subStrIfNeed(final String str, int num)
  4. substring(byte[] array, int start)
  5. substring(byte[] src, int start, int len)
  6. substring(final String pSource, final String pBeginBoundaryString, final String pEndBoundaryString, final int pOffset)
  7. substring(final String s, int start)
  8. substring(final String s, int start, int end)
  9. substring(final String s, int startIndex, int endIndex)