StringUtil { public static int[] startIndexAndEndIndexOf(final String inputString, final String startingWith, final String endingWith) { if (!inputString.contains(startingWith) || !inputString.contains(endingWith)) { return new int[] {}; } final int startIndex = inputString.indexOf(startingWith); if (!((startIndex + 1) < inputString.length())) { return new int[] {}; } final int endIndex = inputString.indexOf(endingWith, startIndex + 1); if (startIndex > endIndex || startIndex < 0 || endIndex < 0) { return new int[] {}; } return new int[] { startIndex, endIndex }; } private  StringUtil(); static String convertToSingleSpace(final String input); static String getFirstSubstring(final String inputString,
            final String startingWith, final String endingWith); static String getFirstSubstring(final String inputString,
            final String startingWith, final String endingWith,
            final int searchFromIndex); static String[] getAllSubstrings(final String inputString,
            final String startingWith, final String endingWith); static int startIndexOf(final String inputString,
            final String startingWith, final String endingWith); static int endIndexOf(final String inputString,
            final String startingWith, final String endingWith); static int startIndexOf(final String inputString,
            final String startingWith, final String endingWith,
            final int searchFromIndex); static int endIndexOf(final String inputString,
            final String startingWith, final String endingWith,
            final int searchFromIndex); static int[] startIndexAndEndIndexOf(final String inputString,
            final String startingWith, final String endingWith); static int[] startIndexAndEndIndexOf(final String inputString,
            final String startingWith, final String endingWith,
            final int searchFromIndex); static int[][] startAndEndIndexesOf(final String inputString,
            final String startingWith, final String endingWith); static String[] cloneArray(final String[] inputArray); static boolean isEqual(final String... strings); static boolean isEqual(final String string1, final String string2); static boolean startsWithWhitespace(final String value); static boolean endsWithWhitespace(final String value); static String[] split(final String string, final char delim); static String[] splitBySpace(final String string); static String[] splitByComma(final String string); static String[] splitBySemicolon(final String string); static String[] splitByColon(final String string); static boolean endsWithSpace(final String string); static boolean endsWithColon(final String string); static boolean startsWithSpace(final String string); static boolean containsSpace(final String string); static boolean containsWhitespace(final String string); static boolean containsMinus(final String string); static boolean containsPlus(final String string); static String join(final char delimiter, final char prefix,
            final char suffix, final String... items); static String join(final char delimiter, final String... items); static String join(final char delimiter,
            final Collection<String> items); static boolean isBlank(final String s); static String strip(final String s);  }
@Test public void testStartIndexAndEndIndexOfStringStringString() { final int[] startIndexAndEndIndex = StringUtil.startIndexAndEndIndexOf( "green rgb(7, 8, 9, 1) rgb(3, 5, 6)", "rgb(", ")"); assertEquals(6, startIndexAndEndIndex[0]); assertEquals(20, startIndexAndEndIndex[1]); assertEquals(2, startIndexAndEndIndex.length); }
@Test public void testStartIndexAndEndIndexOfStringStringStringInt() { final int[] startIndexAndEndIndex = StringUtil.startIndexAndEndIndexOf( "green rgb(7, 8, 9, 1) rgb(3, 5, 6)", "rgb(", ")", 7); assertEquals(22, startIndexAndEndIndex[0]); assertEquals(33, startIndexAndEndIndex[1]); assertEquals(2, startIndexAndEndIndex.length); }