ULOS Manual Pages - text(3) | Back

NAME
  text - utilities for working with text

DESCRIPTION
  The text library contains several useful methods for working with text.

FUNCTIONS
  escape(str:string): string
    Escape all special pattern characters in the provided str.

  split(text:string, split:string or table): table
    Split the provided text on the characters provided in split.

  padRight(n:number, text:string, c:string): string
    Pad the provided text to n characters, concatenating a string of repeating c, of the corresponding length, to the left side of the string.

  padLeft(n:number, text:string, c:string): string
    Pad the provided text to n characters, concatenating a string of repeating c, of the corresponding length, to the right side of the string.

  mkcolumns(items:table[, args:table]): string
    Sorts the items, then columnizes them.  This is mostly intended for use in shell commands but could potentially have other uses.  Columnization is only implemented on a row-first basis.

    args may contain a maxWidth:number field.  This will limit the maximum row width.  If args.hook exists and is a function, it will be called with each item and the text for that item replaced with the result of the hook.

  wrap(text:string, width:number): string
    Wraps the provided text to width characters, ignoring - but preserving! - VT100 escape sequences.  Useful for determining the number of lines a piece of text will take up on screen.

COPYRIGHT
  ULOS Core Libraries copyright (c) 2021 Ocawesome101 under the DSLv2.

REPORTING BUGS
  Bugs should be reported at https://github.com/ocawesome101/oc-ulos/issues.