Prose.Text

References
public sealed class Prose.Text : IComparable<Prose.Text>, IEquatable<Prose.Text>
Represents a string with alternating textual and numeric fragments. This makes mixed number/text comparisons much faster and more reliable.

Properties

Count

#
public int Count { get; }
Gets the total number of fragments.

Fragments

#
public IEnumerable<object> Fragments { get; }
Enumerate over all fragments in this text, returning either a string, or the numeric value.

IsEmpty

#
public bool IsEmpty { get; }
Gets whether this string is empty.

Length

#
public int Length { get; }
Gets the total length of the entire text.

Methods

Comparer

#
public static IComparer<Prose.Text> Comparer(StringComparison comparison)
Create an IComparer<T> for Prose.Text.
comparison (StringComparison)Text fragment comparison to use.

CompareTo

#
public int CompareTo(Text other, StringComparison comparison)
Compare two alphanumeric strings.
other (Prose.Text)Other string.
comparison (StringComparison)Comparison for the string fragments.

CompareTo

#
public int CompareTo(Text other)
Compare two alphanumeric strings.
other (Prose.Text)Other string.

Create

#
public static Prose.Text Create(params object[] fragments)
Create a Prose.Text from a sequence of textual and numeric fragments.
fragments (params object[])A sequence of fragments. Either strings, doubles, integers, big integers, vectors or points.

Equals

#
public override bool Equals(object obj)
obj (object)
Object.Equals

Equals

#
public bool Equals(Text other, StringComparison comparison)
other (Prose.Text)
comparison (StringComparison)

Equals

#
public bool Equals(Text other)
other (Prose.Text)

FragmentAt

#
public int FragmentAt(int charIndex)
Get the fragment which contains the given character index.
charIndex (int)

FragmentSpan

#
public (int index, int length) FragmentSpan(int index)
Gets the character span of a given fragment.
index (int)

GetHashCode

#
public override int GetHashCode()

Parse

#
public static Prose.Text Parse(string text, bool considerVectors)
Parse a string and extract the alphabetic and numeric parts.
text (string)String to parse.
considerVectors (bool)If true, comma separated numbers will be interpreted as vectors.

TextFragment

#
public string TextFragment(int index)
Gets the string fragment at the given index.
index (int)

ToString

#
public override string ToString()
Recreate the original string.
Object.ToString

ValueFragment

#
public object ValueFragment(int index)
Gets the string fragment or numeric value at the given index.
index (int)

Operators

OperationResultDescription
Prose.Text+Prose.TextProse.TextAppend one numeric string to another.

Convertors

OperationResultDescription
implicitstringProse.TextAuto convert a string into a Prose.Text.