C# Class FP.Text.Strings

Provides a set of static (Shared in Visual Basic) methods for strings.
The source of each method includes the Haskell version as a comment at the end. Some methods are not safe to use with mutable collections. These cases are mentioned in the documentation for the method. The order of arguments has generally been inverted compared to the Haskell versions to facilitate method chaining. See also the Remarks for Enumerable.
Show file Open project: lukesandberg/PexFaultLocalization

Public Methods

Method Description
AsString ( this charSequence ) : string

Converts a sequence of chars to a string. This should be called ToString, but this is impossible for the obvious reason.

Clear ( this sb ) : void

Clears the specified StringBuilder. This is equivalent to calling sb.Count = 0.

IsNullOrEmpty ( this s ) : bool

Determines whether the string is null or empty. This is merely string.IsNullOrEmpty(s) as an extension method.

Lines ( this charSequence ) : IEnumerable

Breaks the specified char sequence into a sequence of strings at newline characters. The resulting strings do not contain newlines.

ReverseIterator ( this s ) : IEnumerable

Enumerates the specified string in the reverse order.

UnLines ( this lines ) : IEnumerable

An inverse to Lines. Joins lines, after appending a terminating newline to each.

UnLinesAsString ( this lines ) : string

Equivalent to UnLines().AsString(), but more efficient.

UnLinesCS ( this lines ) : IEnumerable

An inverse to Lines. It joins lines, after appending a terminating newline to each.

UnWords ( this words ) : IEnumerable

An inverse to Words. It joins words, separating them by a single space.

UnWordsAsString ( this words ) : string

Equivalent to UnWords().AsString(), but more efficient.

UnWordsCS ( this words ) : IEnumerable

An inverse to Words. It joins words, separating them by a single space.

Words ( this charSequence ) : IEnumerable

Breaks the specified char sequence into a sequence of words delimited by whitespace. The resulting strings do not contain whitespace.

Method Details

AsString() public static method

Converts a sequence of chars to a string. This should be called ToString, but this is impossible for the obvious reason.
public static AsString ( this charSequence ) : string
charSequence this The char sequence.
return string

Clear() public static method

Clears the specified StringBuilder. This is equivalent to calling sb.Count = 0.
public static Clear ( this sb ) : void
sb this The .
return void

IsNullOrEmpty() public static method

Determines whether the string is null or empty. This is merely string.IsNullOrEmpty(s) as an extension method.
public static IsNullOrEmpty ( this s ) : bool
s this
return bool

Lines() public static method

Breaks the specified char sequence into a sequence of strings at newline characters. The resulting strings do not contain newlines.
public static Lines ( this charSequence ) : IEnumerable
charSequence this The char sequence.
return IEnumerable

ReverseIterator() public static method

Enumerates the specified string in the reverse order.
public static ReverseIterator ( this s ) : IEnumerable
s this
return IEnumerable

UnLines() public static method

An inverse to Lines. Joins lines, after appending a terminating newline to each.
public static UnLines ( this lines ) : IEnumerable
lines this A sequence of strings.
return IEnumerable

UnLinesAsString() public static method

Equivalent to UnLines().AsString(), but more efficient.
public static UnLinesAsString ( this lines ) : string
lines this A sequence of strings.
return string

UnLinesCS() public static method

An inverse to Lines. It joins lines, after appending a terminating newline to each.
public static UnLinesCS ( this lines ) : IEnumerable
lines this A sequence of sequences of chars.
return IEnumerable

UnWords() public static method

An inverse to Words. It joins words, separating them by a single space.
public static UnWords ( this words ) : IEnumerable
words this A sequence of strings.
return IEnumerable

UnWordsAsString() public static method

Equivalent to UnWords().AsString(), but more efficient.
public static UnWordsAsString ( this words ) : string
words this A sequence of strings.
return string

UnWordsCS() public static method

An inverse to Words. It joins words, separating them by a single space.
public static UnWordsCS ( this words ) : IEnumerable
words this A sequence of sequences of chars.
return IEnumerable

Words() public static method

Breaks the specified char sequence into a sequence of words delimited by whitespace. The resulting strings do not contain whitespace.
public static Words ( this charSequence ) : IEnumerable
charSequence this The char sequence.
return IEnumerable