Convert a {@code string} array into a comma delimited {@code string} (i.e., CSV). <p>Useful for {@code toString()} implementations. @param arr the array to display (potentially {@code null} or empty) @return the delimited {@code string}
Convert a {@code string} array into a delimited {@code string} (e.g. CSV). <p>Useful for {@code toString()} implementations. @param arr the array to display (potentially {@code null} or empty) @param delim the delimiter to use (typically a ",") @return the delimited {@code string}
Convert a comma delimited list (e.g., a row from a CSV file) into an array of strings. @param str the input {@code string} (potentially {@code null} or empty) @return an array of strings, or the empty array in case of empty input
Delete any character in a given {@code string}. @param inString the original {@code string} @param charsToDelete a set of characters to delete. E.g. "az\n" will delete 'a's, 'z's and new lines. @return the resulting {@code string}
Take a {@code string} that is a delimited list and convert it into a {@code string} array. <p>A single {@code delimiter} may consist of more than one character, but it will still be considered as a single delimiter string, rather than as bunch of potential delimiter characters, in contrast to {@link #tokenizeToStringArray}. @param str the input {@code string} (potentially {@code null} or empty) @param delimiter the delimiter between elements (this is a single delimiter, rather than a bunch individual delimiter characters) @return an array of the tokens in the list @see #tokenizeToStringArray
Take a {@code string} that is a delimited list and convert it into a {@code string} array. <p>A single {@code delimiter} may consist of more than one character, but it will still be considered as a single delimiter string, rather than as bunch of potential delimiter characters, in contrast to {@link #tokenizeToStringArray}. @param str the input {@code string} (potentially {@code null} or empty) @param delimiter the delimiter between elements (this is a single delimiter, rather than a bunch individual delimiter characters) @param charsToDelete a set of characters to delete; useful for deleting unwanted line breaks: e.g. "\r\n\f" will delete all new lines and line feeds in a {@code string} @return an array of the tokens in the list @see #tokenizeToStringArray
Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).
Convert alternate charset names (eg utf8) to normalized name (eg UTF-8).
<p> Splits the provided text into an array, using whitespace as the separator. Whitespace is defined by {@link Character#isWhitespace(char)}. </p> <p> <p> The separator is not included in the returned string array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class. </p> <p> <p> A <code>null</code> input string returns <code>null</code>. </p> <p> <pre> StringUtils.split(null) = null StringUtils.split("") = [] StringUtils.split("abc def") = ["abc", "def"] StringUtils.split("abc def") = ["abc", "def"] StringUtils.split(" abc ") = ["abc"] </pre>
<p> Splits the provided text into an array, separators specified. This is an alternative to using StringTokenizer. </p> <p> <p> The separator is not included in the returned string array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class. </p> <p> <p> A <code>null</code> input string returns <code>null</code>. A <code>null</code> separatorChars splits on whitespace. </p> <p> <pre> StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("abc def", null) = ["abc", "def"] StringUtils.split("abc def", " ") = ["abc", "def"] StringUtils.split("abc def", " ") = ["abc", "def"] StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"] </pre>
<p> Splits the provided text into an array, separator specified. This is an alternative to using StringTokenizer. </p> <p> <p> The separator is not included in the returned string array. Adjacent separators are treated as one separator. For more control over the split use the StrTokenizer class. </p> <p> <p> A <code>null</code> input string returns <code>null</code>. </p> <p> <pre> StringUtils.split(null, *) = null StringUtils.split("", *) = [] StringUtils.split("a.b.c", '.') = ["a", "b", "c"] StringUtils.split("a..b.c", '.') = ["a", "b", "c"] StringUtils.split("a:b:c", '.') = ["a:b:c"] StringUtils.split("a b c", ' ') = ["a", "b", "c"] </pre>
<p> Splits the provided text into an array with a maximum length, separators specified. </p> <p> <p> The separator is not included in the returned string array. Adjacent separators are treated as one separator. </p> <p> <p> A <code>null</code> input string returns <code>null</code>. A <code>null</code> separatorChars splits on whitespace. </p> <p> <p> If more than <code>max</code> delimited substrings are found, the last returned string includes all characters after the first <code>max - 1</code> returned strings (including separator characters). </p> <p> <pre> StringUtils.split(null, *, *) = null StringUtils.split("", *, *) = [] StringUtils.split("ab de fg", null, 0) = ["ab", "cd", "ef"] StringUtils.split("ab de fg", null, 0) = ["ab", "cd", "ef"] StringUtils.split("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"] StringUtils.split("ab:cd:ef", ":", 2) = ["ab", "cd:ef"] </pre>
Copy the given Enumeration into a {@code string} array. The Enumeration must contain {@code string} elements only. @param enumeration the Enumeration to copy @return the {@code string} array