Class ParseExtensions
A collection of extension methods to help with parsing.
Inheritance
System.Object
ParseExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Execution.dll
Syntax
public static class ParseExtensions
Methods
|
Improve this Doc
View Source
GroupUntil<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>, Boolean)
Gather elements of source into a group while predicate returns false. If predicate returns true, finish the current group and start a new one.
Declaration
public static IEnumerable<Grouped<TSource>> GroupUntil<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, bool inclusive = false)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<TSource> |
source |
|
| System.Func<TSource, System.Boolean> |
predicate |
|
| System.Boolean |
inclusive |
If true, the element that caused predicate to return false will be put in the current group. Otherwise, it'll be in the next one.
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<Grouped<TSource>> |
|
Type Parameters
|
Improve this Doc
View Source
GroupWhile<TSource>(IEnumerable<TSource>, Func<TSource, Boolean, GroupWhileAction>)
Groups elements according to pickAction. For each element, pickAction is called with the element and whether the function is currently making a group.
Groups will be yielded when complete- that is, when pickAction returns LeaveExclude or LeaveInclude.
Declaration
public static IEnumerable<Grouped<TSource>> GroupWhile<TSource>(this IEnumerable<TSource> source, Func<TSource, bool, GroupWhileAction> pickAction)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<TSource> |
source |
|
| System.Func<TSource, System.Boolean, GroupWhileAction> |
pickAction |
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<Grouped<TSource>> |
|
Type Parameters
|
Improve this Doc
View Source
MergeLastIf<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>, Func<TSource, TSource, TSource>)
Call predicate on each element. If that predicate returns true, then call merge on the current and previous elements and yield that instead of either the current or previous element.
Declaration
public static IEnumerable<TSource> MergeLastIf<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, Func<TSource, TSource, TSource> merge)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<TSource> |
source |
|
| System.Func<TSource, System.Boolean> |
predicate |
If this is true for current, call merge(current, previous)
|
| System.Func<TSource, TSource, TSource> |
merge |
If predicate(current) is true, yield merge(current, previous) instead of current or previous.
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<TSource> |
|
Type Parameters
|
Improve this Doc
View Source
SkipBetween<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>, Func<TSource, Boolean>)
Return elements from source until startPredicate returns true, then skip them until endPredicate returns true.
Note that the element endPredicate returns true for will be returned.
Declaration
public static IEnumerable<TSource> SkipBetween<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> startPredicate, Func<TSource, bool> endPredicate)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<TSource> |
source |
|
| System.Func<TSource, System.Boolean> |
startPredicate |
When this returns true, begin skipping elements.
|
| System.Func<TSource, System.Boolean> |
endPredicate |
When this returns true, stop skipping elements and yield the current one.
|
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerable<TSource> |
|
Type Parameters
|
Improve this Doc
View Source
Stringify(IEnumerable<Argument>)
Prettyprint an array of Arguments, with a comma and space between each one.
Declaration
public static string Stringify(this IEnumerable<Argument> source)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<Argument> |
source |
|
Returns
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
Stringify(IEnumerable<Char>)
Turn an IEnumerable of chars into a string.
Declaration
public static string Stringify(this IEnumerable<char> source)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<System.Char> |
source |
|
Returns
| Type |
Description |
| System.String |
|