Prose.CharIndexer

References
public sealed class Prose.CharIndexer
CharIndexer which always return the null char if the index is out of bounds. It's a good class for getting string characters without having to worry about out-of-bounds indices.

Constructors

CharIndexer

#
public CharIndexer(string text)
Create a new character indexer.
text (string)

Properties

Length

#
public int Length { get; }
Gets the length of the string.

Indexers

this[]

#
public char this[int index] { get; }
Gets a char in this string.
index (int)

this[]

#
public string this[int index, int length] { get; }
Gets an entire string.
index (int)
length (int)

Methods

CharacterEquals

#
public bool CharacterEquals(int index, string characters)
Test whether the indexer matches a string of characters at the given index.
index (int)Index within indexer where the match begins.
characters (string)Characters to match.
True if characters are found at the given index.

DigitAt

#
public bool DigitAt(int index, bool regular = true, bool subscript = false, bool superscript = false)
Gets whether the character at the given index if a digit.
index (int)
regular (bool = true)If true, regular digits are accepted.
subscript (bool = false)If true, subscript digits are accepted.
superscript (bool = false)If true, superscript digits are accepted.
True if the indexed character is a digit.

SignAt

#
public bool SignAt(int index, bool regular = true, bool subscript = false, bool superscript = false)
Gets whether the character at the given index if a plus or minus sign.
index (int)
regular (bool = true)If true, regular signs are accepted.
subscript (bool = false)If true, subscript signs are accepted.
superscript (bool = false)If true, superscript signs are accepted.
True if the indexed character is a sign.