>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  User

format: formatting utilities

Name Type Description
center verb center text in given width
clipfmt verb format data for clipboard
clipunfmt verb unformat data read from clipboard
colhdr verb define column headers
expandby conj expand data with a given value
expandn verb expand data at every nth item
flatten verb flatten array to a character string
fmt verb format a numeric matrix, various format specs
fold verb fold text to width
hexdump verb show text as hex and ascii characters
nfmt verb simple numeric formatter
ruler verb formatted ruler
sqzint verb squeeze list of positive integers into short form
sqzrun verb squeeze list of numbers into short form
xfmt verb format extended integers

center

center text in given width
form: width center text

clipfmt

format data for clipboard
format array of rank 0 1 or 2 for clipboard.
columns are separated by TAB, rows by CRLF.

clipunfmt

unformat data read from clipboard
returns boxed matrix from clipboard result,
recognizing TAB and CRLF as separators.
characters are not converted to numbers.
note this is not a true inverse of clipfmt.
e.g. try:  clipunfmt clipfmt i.5 6

colhdr

define column headers
returns matrix of column headers.

y. = list with columns delimited by semicolons; and lines
     in each column delimited by commas.
x. is wid or (wid;just), where:
  wid  = column widths
  just = a singleton or vector of:
       0 = centre header, then right justify (default)
       1 = center header in wid
       2 = right justify
       3 = left justify

e.g.  hdr=. 'Number,of,employees;Total,salary;Monthly,net,payment'
      (15 12 12;1) colhdr hdr

expandby

expand data with a given value
e.g.    0 1 0 0 1 expandby 99 [ 10 20
     99 10 99 99 20

expandn

expand data at every nth item
n expandn dat
expand array at every nth cell.
e.g. 'ABC DEF G' = 3 expandn 'ABCDEFG'

flatten

flatten array to a character string
flattens array to a character string with same display

fmt

format a numeric matrix, various format specs
syntax: specs fmt nums

nums = numeric vector or matrix or boxed list
       a vector is treated as a 1-row matrix.
       a boxed list is treated as boxed columns
specs= formats, separated by commas, applied
       to each column, or item if boxed.

formats are either edit or positional:
edit formats have the form: {o}w{.d}, where:
  o is optional qualifiers from the set:
     nr=n repetitions (must be given first)
      b=blank if zero
      c=commas
      z=zero fill
  w is field width
  d is decimal places

positional formats have the form:
  xn    = n blanks, e.g. x3

e.g. 'c10.3,x2,2rz5'  has formats:
        width 10, decimal places 3, commas
        2 blanks
        width 5, zero fill, repeated twice

fold

fold text to width
syntax:   {width} fold data
data is character vector
width defaults to screenwidth

nfmt

simple numeric formatter
simple format of numeric vector or matrix in readable form.
opt is optional, up to 3 elements:
  0 = maximum decimal places, max 9  (4)
  1 = minimum field width            (0)
  2 = display width                  (screenwidth)

ruler

formatted ruler
returns a formatted ruler
e.g.    ruler 75      horizontal
      1 ruler 30      vertical

sqzint

squeeze list of positive integers into short form
Squeeze list of positive integers into short character list.
If x. = 1, sort y. first.
e.g.  sqzint 1 2 3 7 8 9 10  =  1-3,7-10
see also <sqzrun>

sqzrun

squeeze list of numbers into short form
Squeeze list of numbers into short character list.
e.g.  sqzrun 1.1 1.1 1.1 7 9 9 10.25 = 3#1.1,7,2#9,10.25
See also <sqzint>.

xfmt

format extended integers
form: [width] xfmt number
groups in 3's up to 1e12, and 5's thereafter


>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  User