class SdlStringInput
implements Input

The SdlStringInput class implements the Input interface for a string input. It provides methods to read and chunk the input string.

Constructors

new
SdlStringInput(input: string)

Properties

private
readonly
input: string
readonly
length

The length of the document.

lineChunks: boolean

Indicates that the chunks do not already end at line breaks and that client code that wants to work by-line must scanning for line breaks.

Methods

chunk(from: number): string

Get the chunk from the given position. The returned string starts at from (0-based) and, if that isn't the end of the string, may be of any length greater than zero.

read(
from: number,
to: number,
): string

Read the part of the document between the given positions.

Usage

import { SdlStringInput } from ".";