/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
/** * Splits this string using the supplied {@code regularExpression}. * See {@link Pattern#split(CharSequence, int)} for an explanation of {@code limit}. * See {@link Pattern} for regular expression syntax. * * <p>If the same regular expression is to be used for multiple operations, it may be more * efficient to reuse a compiled {@code Pattern}. * * @throws NullPointerException if {@code regularExpression == null} * @throws PatternSyntaxException * if the syntax of the supplied regular expression is not * valid. * @since 1.4 */ public String[] split(String regularExpression, int limit) { String[] result = java.util.regex.Splitter.fastSplit(regularExpression, this, limit); return result != null ? result : Pattern.compile(regularExpression).split(this, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }
public static String[] split(Pattern pattern, String re, String input, int limit) { String[] fastResult = fastSplit(re, input, limit); if (fastResult != null) { return fastResult; } // Unlike Perl, which considers the result of splitting the empty string to be the empty // array, Java returns an array containing the empty string. if (input.isEmpty()) { return new String[] { "" }; } // Collect text preceding each occurrence of the separator, while there's enough space. ArrayList<String> list = new ArrayList<String>(); Matcher matcher = new Matcher(pattern, input); int begin = 0; while (list.size() + 1 != limit && matcher.find()) { list.add(input.substring(begin, matcher.start())); begin = matcher.end(); } return finishSplit(list, input, begin, limit); }