public static String getFirstSubstring(final String inputString,
            final String startingWith, final String endingWith) {
        if (!inputString.contains(startingWith)
                || !inputString.contains(endingWith)) {
            return null;
        }
        final int startIndex = inputString.indexOf(startingWith);

        if (!((startIndex + 1) < inputString.length())) {
            return null;
        }

        final int endIndex = inputString.indexOf(endingWith, startIndex + 1)
                + 1;
        if (startIndex > endIndex || startIndex < 0 || endIndex < 0) {
            return null;
        }
        return inputString.substring(startIndex, endIndex);
    }
public static String getFirstSubstring(final String inputString,
            final String startingWith, final String endingWith) {
        if (!inputString.contains(startingWith)
                || !inputString.contains(endingWith)) {
            return null;
        }
        final int startIndex = inputString.indexOf(startingWith);

        if (!((startIndex + 1) < inputString.length())) {
            return null;
        }

        final int endIndex = inputString.indexOf(endingWith, startIndex + 1)
                + 1;
        if (startIndex > endIndex || startIndex < 0 || endIndex < 0) {
            return null;
        }
        return inputString.substring(startIndex, endIndex);
    }
public static String getFirstSubstring ( final String inputString , final String startingWith , final String endingWith ) { if ( ! inputString . contains ( startingWith ) || ! inputString . contains ( endingWith ) ) { return null ; } final int startIndex = inputString . indexOf ( startingWith ) ; if ( ! ( ( startIndex + 1 ) < inputString . length ( ) ) ) { return null ; } final int endIndex = inputString . indexOf ( endingWith , startIndex + 1 ) + 1 ; if ( startIndex > endIndex || startIndex < 0 || endIndex < 0 ) { return null ; } return inputString . substring ( startIndex , endIndex ) ; }
gets the first substring which starts and ends with the given values.

@param inputString
the string from which the substring will be
extracted.
@param startingWith
to match the starting substring
@param endingWith
to match the ending substring
@return the substring which starts and ends with the given
{@code startingWith} and {@code endingWith} values. Or returns
null if it doesn't contain.
@author WFF
@since 1.0.0
gets the first substring which starts and ends with the given values .