Word

class Word(val parts: Sequence<String>)(source)

A notation-agnostic representation of a string. This is a “word” in the sense of “word over the Unicode alphabet”, not in the sense of a word in any spoken language. A Word consists of parts.

Constructors

Link copied to clipboard
constructor(vararg parts: String)
constructor(parts: List<String>)
constructor(parts: Sequence<String>)

Properties

Link copied to clipboard

The different parts this word consists of. A StringNotation will parse a given input into its parts and print a Word by combining its parts appropriately.

Link copied to clipboard

Gives the parts as a List.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun flatMapParts(transform: (String) -> Sequence<String>): Word

Creates a new word, with all its parts transformed by the provided transform function, which may return more than one new part for every existing part.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun mapParts(transform: (String) -> String): Word

Creates a new word, with all its parts transformed by the provided transform function.

Link copied to clipboard

Creates a new word, with all its parts parsed by the provided notation. Allows to parse words that use a combination of notations.

Link copied to clipboard
operator fun plus(word: Word): Word

Creates a copy of this word with all parts of the provided word appended.

fun plus(vararg parts: String): Word

Creates a copy of this word with all provided parts appended.

operator fun plus(part: String): Word

Creates a copy of this word with the provided part appended.

Link copied to clipboard

Converts this word into a string according to the given notation.

Link copied to clipboard
open override fun toString(): String