@Test void replaceFirst() { Assertions.assertEquals("a b c", StringUtils.replaceFirst("b b c", "b", "a")); Assertions.assertEquals("a b c", StringUtils.replaceFirst("a b c", "d", "e")); Assertions.assertEquals("abc", StringUtils.replaceFirst("aac", "a", "b", 1)); Assertions.assertEquals("abc", StringUtils.replaceFirst("abc", "d", "e", 4)); }
public static String replaceFirst(String text, String pattern, String replacement) { return replaceFirst(text, pattern, replacement, 0); }
StringUtils { public static String replaceFirst(String text, String pattern, String replacement) { return replaceFirst(text, pattern, replacement, 0); } }
StringUtils { public static String replaceFirst(String text, String pattern, String replacement) { return replaceFirst(text, pattern, replacement, 0); } private  StringUtils(); }
StringUtils { public static String replaceFirst(String text, String pattern, String replacement) { return replaceFirst(text, pattern, replacement, 0); } private  StringUtils(); static String[] splitFirst(String text, String delimiter); static String[] split(String text, String delimiter); static int lastIndexOfBefore(String text, String element, int occurrences); static int lastIndexOf(String text, String element, int toIndex); static String replace(String text, String searchString, String replacement); static String replaceFirst(String text, String pattern, String replacement); static String replaceFirst(String text, String pattern, String replacement, int start); static String replaceRespectively(String text, String pattern, String... values); static String replaceRespectivelyAndSoftly(String text, String pattern, String... values); static String capitalize(String text); static boolean startsWith(String text, Predicate<char[]> filter); static String trimStart(String text); static String trimEnd(String text); static String extractParagraph(String str); static String buildSpace(int spaces); static String repeated(int repetitions, String... elements); static int countOccurrences(String text, String element); static boolean containsCharacter(String text, char... characters); static boolean containsSpecialCharacters(String text); static boolean containsOtherCharacters(String text, char[]... characters); static String join(String... strings); static String toString(@Nullable Object object); static boolean isNumber(String str); static String isEmpty(String text, String exceptionMessage); static boolean isEmpty(String text); }
StringUtils { public static String replaceFirst(String text, String pattern, String replacement) { return replaceFirst(text, pattern, replacement, 0); } private  StringUtils(); static String[] splitFirst(String text, String delimiter); static String[] split(String text, String delimiter); static int lastIndexOfBefore(String text, String element, int occurrences); static int lastIndexOf(String text, String element, int toIndex); static String replace(String text, String searchString, String replacement); static String replaceFirst(String text, String pattern, String replacement); static String replaceFirst(String text, String pattern, String replacement, int start); static String replaceRespectively(String text, String pattern, String... values); static String replaceRespectivelyAndSoftly(String text, String pattern, String... values); static String capitalize(String text); static boolean startsWith(String text, Predicate<char[]> filter); static String trimStart(String text); static String trimEnd(String text); static String extractParagraph(String str); static String buildSpace(int spaces); static String repeated(int repetitions, String... elements); static int countOccurrences(String text, String element); static boolean containsCharacter(String text, char... characters); static boolean containsSpecialCharacters(String text); static boolean containsOtherCharacters(String text, char[]... characters); static String join(String... strings); static String toString(@Nullable Object object); static boolean isNumber(String str); static String isEmpty(String text, String exceptionMessage); static boolean isEmpty(String text); static final String EMPTY; static final String[] EMPTY_ARRAY; }