/** * Splits a String by delimiter as long as delimiter does not follow an escape sequence. * The split method follows the same behavior as the method splitPreserveAllTokens(String, String) * in {@link org.apache.commons.lang.StringUtils}. * * @param value the string to split, may be null. * @param delimiter the delimiter sequence. A null delimiter splits on whitespace. * @param escape the escape sequence. A null escape is allowed, and result will be consistent with the splitPreserveAllTokens method. * @return an array of split edi-sequences, null if null string input. */ public static String[] split(String value, String delimiter, String escape) { // A null input string returns null if (value == null) { return null; } // Empty input string returns empty array if (value.length() == 0) { return new String[0]; } // Empty delimiter splits on whitespace. if (delimiter == null) { delimiter = " "; } List<CharSequence> charSequences = new ArrayList<CharSequence>(); readSequenceStructure(value, delimiter, escape, charSequences); return putCharacterSequenceIntoResult(charSequences); }
/** * Splits a String by delimiter as long as delimiter does not follow an escape sequence. * The split method follows the same behavior as the method splitPreserveAllTokens(String, String) * in {@link org.apache.commons.lang.StringUtils}. * * @param value the string to split, may be null. * @param delimiter the delimiter sequence. A null delimiter splits on whitespace. * @param escape the escape sequence. A null escape is allowed, and result will be consistent with the splitPreserveAllTokens method. * @return an array of split edi-sequences, null if null string input. */ public static String[] split(String value, String delimiter, String escape) { // A null input string returns null if (value == null) { return null; } // Empty input string returns empty array if (value.length() == 0) { return new String[0]; } // Empty delimiter splits on whitespace. if (delimiter == null) { delimiter = " "; } List<CharSequence> charSequences = new ArrayList<CharSequence>(); readSequenceStructure(value, delimiter, escape, charSequences); return putCharacterSequenceIntoResult(charSequences); }
/** * Splits a String by delimiter as long as delimiter does not follow an escape sequence. * The split method follows the same behavior as the method splitPreserveAllTokens(String, String) * in {@link org.apache.commons.lang.StringUtils}. * * @param value the string to split, may be null. * @param delimiter the delimiter sequence. A null delimiter splits on whitespace. * @param escape the escape sequence. A null escape is allowed, and result will be consistent with the splitPreserveAllTokens method. * @return an array of split edi-sequences, null if null string input. */ public static String[] split(String value, String delimiter, String escape) { // A null input string returns null if (value == null) { return null; } // Empty input string returns empty array if (value.length() == 0) { return new String[0]; } // Empty delimiter splits on whitespace. if (delimiter == null) { delimiter = " "; } List<CharSequence> charSequences = new ArrayList<CharSequence>(); readSequenceStructure(value, delimiter, escape, charSequences); return putCharacterSequenceIntoResult(charSequences); }
/** * Splits a String by delimiter as long as delimiter does not follow an escape sequence. * The split method follows the same behavior as the method splitPreserveAllTokens(String, String) * in {@link org.apache.commons.lang.StringUtils}. * * @param value the string to split, may be null. * @param delimiter the delimiter sequence. A null delimiter splits on whitespace. * @param escape the escape sequence. A null escape is allowed, and result will be consistent with the splitPreserveAllTokens method. * @return an array of split edi-sequences, null if null string input. */ public static String[] split(String value, String delimiter, String escape) { // A null input string returns null if (value == null) { return null; } // Empty input string returns empty array if (value.length() == 0) { return new String[0]; } // Empty delimiter splits on whitespace. if (delimiter == null) { delimiter = " "; } List<CharSequence> charSequences = new ArrayList<CharSequence>(); readSequenceStructure(value, delimiter, escape, charSequences); return putCharacterSequenceIntoResult(charSequences); }