Text

Description

sealed class Tinman.Core.Formatting.Text

Derived from

EnumerableBase<string> abstract

Represents a chunk of text and provides access to the text lines.

The IEnumerable.GetEnumerator method will iterate through the text lines, returning the result of Line for the line indices from 0 to LineCount-1.

Public / Methods

For


public static method For → (1)

text in : string

[not-null]
The text string value.

returns → Text

The created Text object.

Creates a new instance of Text.

Line


[Pure]
public method Line → (1)

index in : int32

[0..Text.LineCount-1]
The zero-based line index.

returns → string

The line of text.

Returns the index in-th line of text.

Line​At


[Pure]
public method LineAt → (1)

offset in : int32

[0..Text.Length]
The text offset.

returns → int32

The zero-based line index.

Returns the index of the text line that contains the given offset.

Line​End


[Pure]
public method LineEnd → (1)

index in : int32

[0..Text.LineCount-1]
The zero-based line index.

returns → int32

The line end offset (exclusive).

Returns the end offset of the index in-th line.

Line​Length


[Pure]
public method LineLength → (1)

index in : int32

[0..Text.LineCount-1]
The zero-based line index.

returns → int32

The line length.

Returns the length of the index in-th line.

Line​Start


[Pure]
public method LineStart → (1)

index in : int32

[0..Text.LineCount-1]
The zero-based line index.

returns → int32

The line start offset (inclusive).

Returns the start offset of the index in-th line.

Offset​At


[Pure]
public method OffsetAt → (2)

row in : int32

[0..Text.LineCount-1]
The zero-based line index.

column in : int32

[>=0]
The zero-based column index.

returns → int32

Offset of text location.

Returns the offset of the given text location.

Position​At


[Pure]
public method PositionAt → (2)

offset in : int32

[0..Text.Length]
The text offset.

oneBased opt : bool = false

true to return one-based row and column numbers,
false to return zero-based ones.

returns → Vec2I

The text position:
Vec2I.X : the column number
Vec2I.Y : the row number

Returns the text position at the given text offset.

To​Array


public method ToArray → ()

returns → string [ ]

The text line array.

Returns the text lines as an array.

To​String

2 overloads


public method ToString1 → (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.

Public / Attributes

Length


public attribute Length → (get)

value : int32

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

Returns the length of the original text value that has been passed to For.

See also

Text.Value

Line​Count


public attribute LineCount → (get)

value : int32

[>=1]
The text line count.

Returns the number of text lines in this text.

Max​Line​Length


public attribute MaxLineLength → (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 value that has been passed to For.

See also

Text.Length