# std/wordwrap

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

This module contains an algorithm to wordwrap a Unicode string.

# Imports

strutils, unicode

# Procs

    proc wrapWords(s: string; maxLineWidth = 80; splitLongWords = true;
                   seps: set[char] = Whitespace; newLine = "\n"): string {.
        noSideEffect, ...raises: [], tags: [], forbids: [].}

  Word wraps `s`.

  Example:

      doAssert "12345678901234567890".wrapWords() == "12345678901234567890"
      doAssert "123456789012345678901234567890".wrapWords(20) == "12345678901234567890\n1234567890"
      doAssert "Hello Bob. Hello John.".wrapWords(13, false) == "Hello Bob.\nHello John."
      doAssert "Hello Bob. Hello John.".wrapWords(13, true, {';'}) == "Hello Bob. He\nllo John."

  Source Edit