I think we need to think about defining what kind of boundary we want between Commons Lang and Commons Text before StringUtils becomes even more of a kitchen sink.
Gary On Fri, Nov 20, 2020, 08:20 GitBox <[email protected]> wrote: > > aakashgupta96 commented on a change in pull request #645: > URL: https://github.com/apache/commons-lang/pull/645#discussion_r527685407 > > > > ########## > File path: src/main/java/org/apache/commons/lang3/StringUtils.java > ########## > @@ -7731,6 +7731,48 @@ public static String rotate(final String str, final > int shift) { > return substrings.toArray(ArrayUtils.EMPTY_STRING_ARRAY); > } > > + /** > + * Split a {@link String} into a {@code String []} of fixed-length > elements. > + * > + * <pre> > + * StringUtils.splitEvery("test1",10) = ["test1"] > + * StringUtils.splitEvery("test2", 4) = ["test","2"] > + * StringUtils.splitEvery("testAbgTestsABG", -2) = > ["testAbgTestsABG"] > + * StringUtils.splitEvery("",10) = [""] > + * StringUtils.splitEvery(null,4) = {@code null} > + * StringUtils.splitEvery("testAbgTestsABG",2) = > ["te","st","Ab","gT","es","ts","AB","G"] > + * </pre> > + * > + * @param str {@link String} to split into fixed length elements. > + * @param length length of the elements into which the String will be > divided. > + * @return a {@code String []} of fixed-length elements. > + */ > + public static String[] splitEvery( final String str, final int length > ) { > > Review comment: > I think it'll be better to throw `IllegalArgumentException` in case > `length <1 || length > str.length()`. @arturobernalg Thoughts? > > > > > ---------------------------------------------------------------- > This is an automated message from the Apache Git Service. > To respond to the message, please log on to GitHub and use the > URL above to go to the specific comment. > > For queries about this service, please contact Infrastructure at: > [email protected] > > >
