IText

Description

interface Tinman.Core.Formatting.IText

Derived from

IEquatable<IText>
IEnumerable<string>

Extended by

ICodeInput
TextBase abstract

Base interface for classes that provide access to a text value with one or more lines (the empty text is represented with a single empty line).

An implementation may wrap a sequential character stream and provide incremental reading by fetching only the required data from the stream when using these members:

Using these members, on the other hand, will cause the whole data stream to be read:

The IEnumerable.GetEnumerator method will iterate through the text lines, by delegating to LineRange and CharsAt.

See also

Text.For

Public / Methods

Char​At


public method CharAt → (1)

index in : int32

The zero-based character index, see Length.

returns → char

The character or '\0' if out of range.

Returns the character at the given index in.

Chars​At


public method CharsAt → (1)

range in : RangeI

The zero-based character index range, see Length.

returns → string

The character range or the empty string if out of range.

Returns the characters in the given index range in.

Line​Index


public method LineIndex → (1)

index in : int32

The zero-based character index, see Length.

returns → int32

The line index. Will be clamped if index in is out of range.

Returns the line that contains the given character.

Line​Range


public method LineRange → (1)

index in : int32

The zero-based line index, see LineCount.

returns → RangeI

The character range, see Length. Will be RangeI.Inv iff index in is out of range.

Returns the character range of the given line.

Public / Attributes

Length


public attribute Length → (get)

value : int32

[>=0]
Length of the original text value, in characters.

Returns the length of the original text value.

See also

IText.Value

Line​Count


public attribute LineCount → (get)

value : int32

[>=1]
The line count.

Returns the number of lines in this text.

The empty text has a single empty line.

Line​Length​Maximum


public attribute LineLengthMaximum → (get)

value : int32

[>=0]
The maximum line length.

Returns the maximum line length in this text.

Value


public attribute Value → (get)

value : string

[not-null]
The original text value.

Returns the original text value (which includes newline characters, if any).

See also

IText.Length

Extensions

Index​At

2 overloads


[Pure]
public static method IndexAt1 → (2)

row in : int32

The zero-based row index, see IText.LineCount.

column in : int32

The zero-based column index.

returns → int32

The zero-based character index of the text position. Will be 0 if row in or column in is out of range.

Returns the zero-based character index at the given text position, by delegating to IText.LineRange.


[Pure]
public static method IndexAt2 → (1)

position in : TextPosition

The text position.

returns → int32

zero-based The character index of the text position. Will be 0 if position in is out of range.

Returns the zero-based character index at the given text position, by delegating to IText.LineRange.

Line​At


public static method LineAt → (1)

index in : int32

The zero-based line index, see IText.LineCount.

returns → string

The line. Will be empty if index in is out of range.

Returns the content of a line, by delegating to IText.LineRange and IText.CharsAt.

Position​At

2 overloads


[Pure]
public static method PositionAt1 → (1)

index in : int32

The zero-based character index, see IText.Length.

returns → TextPosition

The text position.

Returns the text position at the given character index, by delegating to IText.LineIndex and IText.LineRange.


[Pure]
public static method PositionAt2 → (2)

row in : int32

The zero-based row index, see IText.LineCount.

column in : int32

The zero-based column index.

returns → TextPosition

The text position.

Returns the text position at the given row/column indices.

To​Array


public static method ToArray → ()

returns → string [ ]

The text line array.

Returns the text lines as an array, by delegating to IText.LineCount and LineAt.

To​String


[Pure]
public static method ToString → (2)

lineNumbers in : bool

Output line numbers?

lineEnding opt : LineEnding = LineEnding.LF

The line ending to use.

returns → string

The concatenated string value.

Returns this text as a concatenated string value, using the given LineEnding, by delegating to IText.LineCount and LineAt.