StringSegment structure

Encapsulates a length of characters from a string starting at a particular offset.

public struct StringSegment : IComparable<StringSegment>, IEnumerable<char>, 
    IEquatable<StringSegment>

Public Members

name description
StringSegment(…) Initializes a new instance of the StringSegment class. (4 constructors)
static readonly Empty An empty segment of the empty string.
Chars { get; } Gets the Char with the specified index.
Length { get; } Gets the length of the segment.
Offset { get; } Gets the offset into the source string.
Source { get; } Gets the source string.
After() Returns everything that follows this segment in the source string.
AppendToStringBuilder(…) Appends the segment to the specified StringBuilder.
Before() Returns everything that precedes this segment in the source string.
CompareTo(…) Compares the current object with another object of the same type.
CopyTo(…) Copies the characters of the string segment to an array.
override Equals(…) Indicates whether this instance and a specified object are equal.
Equals(…) Indicates whether the current object is equal to another object of the same type.
GetEnumerator() Returns an enumerator that iterates through the characters of the string segment.
override GetHashCode() Returns the hash code for this instance.
IndexOf(…) Returns the first index of the specified character in the string segment. (3 methods)
IndexOfAny(…) Returns the first index of any of the specified characters in the string segment.
Intersect(…) Intersects this segment with another segment of the same string.
LastIndexOf(…) Returns the last index of the specified character in the string segment. (2 methods)
LastIndexOfAny(…) Returns the last index of any of the specified characters in the string segment.
Match(…) Matches the specified regex against the segment.
Redirect(…) Returns a new StringSegment with the same owner string. (3 methods)
Split(…) Splits the string segment by the specified regular expression.
Substring(…) Returns a sub-segment of this segment. (2 methods)
ToCharArray() Returns the array of characters represented by this string segment.
override ToString() Returns the string segment as a string.
ToStringBuilder() Returns the string segment as a StringBuilder.
ToStringBuilder(…) Returns the string segment as a StringBuilder.
Trim() Trims the whitespace from the start and end of the string segment.
Trim(…) Trims the specified characters from the start and end of the string segment.
TrimEnd() Trims the specified characters from the end of the string segment.
TrimEnd(…) Trims the whitespace from the end of the string segment.
TrimStart() Trims the specified characters from the start of the string segment.
TrimStart(…) Trims the whitespace from the start of the string segment.
Union(…) Returns the union of this segment with another segment of the same string.
static Compare(…) Compares two string segments.
static CompareOrdinal(…) Compares two string segments ordinally.
operator == Compares two string segments for equality.
operator != Compares two string segments for inequality.

See Also