Utf8ByteIndex

class Utf8ByteIndex(text: String)

Constructors

Link copied to clipboard
constructor(text: String)

Properties

Link copied to clipboard

Total UTF-8 byte length of the source text.

Link copied to clipboard

Number of lines (1 for empty string, otherwise count of \n + 1).

Functions

Link copied to clipboard
fun byteIndexAt(charOffset: Int): Int
Link copied to clipboard
fun charIndexAt(byteOffset: Int): Int
Link copied to clipboard
fun lineAt(byteOffset: Int): Int

Line number (0-based) containing the given byte offset.

Link copied to clipboard
fun lineStartByte(line: Int): Int

Byte offset where line line starts (0-based).