protected SplittingEnumerable(Splitter splitter, string toSplit) { this.trimmer = splitter.trimmer; this.omitEmptyStrings = splitter.omitEmptyStrings; this.spitterLimit = splitter.limit; this.ToSplit = toSplit; }
private Splitter(SplittingEnumerableProducer enumerableProducer, bool omitEmptyStrings, CharMatcher trimmer, int limit) { this.enumerableProducer = enumerableProducer; this.omitEmptyStrings = omitEmptyStrings; this.trimmer = trimmer; this.limit = limit; }
/// <summary> /// Returns a matcher that matches any character matched by either this matcher or <c>other</c>. /// </summary> public virtual CharMatcher Or(CharMatcher other) { return(new OrMatcher(this, other)); }
/// <summary> /// Returns a matcher that matches any character matched by both this matcher and <c>other</c>. /// </summary> public virtual CharMatcher And(CharMatcher other) { return(new AndMatcher(this, other)); }
internal OrMatcher(CharMatcher a, CharMatcher b) { first = CheckNotNull(a); second = CheckNotNull(b); }
public override CharMatcher Or(CharMatcher other) { CheckNotNull(other); return(this); }
public override CharMatcher And(CharMatcher other) { return(CheckNotNull(other)); }
/// <summary> /// Returns a splitter that considers any single character matched by the /// given <c>CharMatcher</c> to be a separator.For example, /// <code>Splitter.On(CharMatcher.anyOf(";,")).split("foo,;bar,quux")</code> ///returns an iterable containing <c>["foo", "", "bar", "quux"]</c>. /// </summary> /// <param name="separatorMatcher">a <see cref="CharMatcher"/> that determines /// whether a character is a separator</param> /// <returns>a splitter, with default settings, that uses this matcher</returns> public static Splitter On(CharMatcher separatorMatcher) { CheckNotNull(separatorMatcher); return(new Splitter(ByCharMatcherSplitterStrategy(separatorMatcher))); }
/// <summary> /// Returns a splitter that uses the given single-character separator. For example, /// <code>Splitter.On(',').split("foo,,bar")</code> returns an iterable containing /// <c>["foo", "", "bar"]</c> /// </summary> /// <param name="separator">the character to recognize as a separator</param> /// <returns>a splitter, with default settings, that recognizes that separator</returns> public static Splitter On(char separator) { return(On(CharMatcher.isChar(separator))); }
public ByCharMatcherSplittingEnumerable(Splitter splitter, string toSplit, CharMatcher separatorMatcher) : base(splitter, toSplit) { this.separatorMatcher = separatorMatcher; }
private static SplittingEnumerableProducer ByCharMatcherSplitterStrategy(CharMatcher separatorMatcher) { return((splitter, toSplit) => new ByCharMatcherSplittingEnumerable(splitter, toSplit, separatorMatcher)); }
public Splitter TrimResults(CharMatcher trimmer) { CheckNotNull(trimmer); return(new Splitter(enumerableProducer, omitEmptyStrings, trimmer, limit)); }