Java String Sub String subString(String input, char start, char end)

Here you can find the source of subString(String input, char start, char end)

Description

sub String

License

Open Source License

Declaration

public static String subString(String input, char start, char end) 

Method Source Code

//package com.java2s;

public class Main {

    public static String subString(String input, char start, char end) {
        int intStart = input.indexOf(String.valueOf(start));
        if (intStart < 0) {
            return input;
        }//from ww w . jav a2 s  . c  o  m
        intStart++;
        String ret = input.substring(intStart);
        int intEnd = ret.indexOf(String.valueOf(end));
        if (intEnd < 0) {
            return input;
        }
        return ret.substring(0, intEnd);
    }

    public static int indexOf(String target, String[] source) {
        int loop = 0;
        int index = 0;
        try {
            index = -1;
            for (String value : source) {
                if (target.equals(value)) {
                    index = loop;
                    break;
                }
                loop++;
            }

            return index;
        } finally {

        }
    }
}

Related

  1. substring(final String str, int start, int end)
  2. substring(final String string, int fromIndex, int toIndex)
  3. substring(final String text, final int position, final int length)
  4. substring(String _text, int _idx)
  5. substring(String baseString, int start, int end)
  6. substring(String input, int expectedLength)
  7. substring(String input, int maxLength)
  8. substring(String input, int maxLength)
  9. subString(String input, String startStr, String endStr)