Skip to content
FutureBlitz

    Install

    Import std.text.layout

    std.text.layout

    std.text.layout: a String's lines laid out again. WordWrap fills lines up to a width in a terminal's columns, Dedent takes away the indentation every line has, and Indent puts a prefix before each line. A line ends at "\n", "\r\n", or "\r", and each keeps its line break.

    std/text/layout.fb

    Functions

    Levenshtein function

    Public Function Levenshtein(a: String, b: String): Int

    How many single-character edits, inserting, deleting, or changing a character, turn a into b, counting characters, code points.

    std/text/layout.fb, line 214

    Extends

    String extend

    Extend String

    No doc comment.

    std/text/layout.fb, line 14

    • @PanicsAtCaller Public Method WordWrap(width: Int): String method #

      Its lines filled with words up to width columns each, as a terminal shows them, with DisplayWidth and a tab going on to the next multiple of 8 columns: each line breaks before the word that would go past it, at the spaces before that word, which go, while the spaces between words that stay on a line stay as they are. A no-break space, U+00A0, U+2007, or U+202F, is part of its word, not a place to break. A line's leading whitespace starts each line it becomes, and a word wider than the rest of the width is broken between its grapheme clusters. Panics when width is below 1.

    • Public Method Dedent(): String method #

      A copy without the leading spaces and tabs that each line that isn't blank starts with, all alike, as when text is written indented in code. A blank line becomes empty.

    • Public Method Indent(prefix: String): String method #

      A copy with prefix before each line that isn't blank.

    Report an issue with this page or with FutureBlitz on GitHub.