string-notation / de.joshuagleitze.stringnotation / Word

Word

class Word

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

<init>

Word(vararg parts: String)
Word(parts: List<String>)

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.

Word(parts: Sequence<String>)

Properties

parts

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.

val parts: Sequence<String>

partsList

Gives the parts as a List.

val partsList: List<String>

Functions

equals

fun equals(other: Any?): Boolean

flatMapParts

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.

fun flatMapParts(transform: (String) -> Sequence<String>): Word

hashCode

fun hashCode(): Int

mapParts

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

fun mapParts(transform: (String) -> String): Word

partsFromNotation

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

fun partsFromNotation(notation: StringNotation): Word

plus

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

operator fun plus(part: String): Word

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

fun plus(vararg parts: String): Word

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

operator fun plus(word: Word): Word

toNotation

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

fun toNotation(notation: StringNotation): String

toString

fun toString(): String