FORMAT

formatting utilities

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

Defined items
NameClassDescription
centerVerbwidth center text
clipfmtVerbformat data for clipboard
clipunfmtVerbunformat data read from clipboard
colhdrVerbcolumn headers
expandbyVerbexpand data with fit value
expandnVerbexpand data at every nth item
flattenVerbflatten array to a character string
fmtVerbformat numeric matrix, various options
foldVerbfold text to width
hexdumpVerbshow text as hex and ascii characters
nfmtVerbsimple numeric formatter
rulerVerbreturns formatted ruler
sqzintVerbsqueeze list of positive integers into short form
sqzrunVerbsqueeze list of numbers into short form
xfmtVerbformat extended integers

center.............. (v) width center text

form: width center text

clipfmt............. (v) format data for clipboard

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

clipunfmt........... (v) 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.............. (v) 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............ (v) expand data with fit value

e.g.    0 1 0 0 1 expandby 99 [ 10 20
     99 10 99 99 20

expandn............. (v) expand data at every nth item

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

flatten............. (v) flatten array to a character string

flattens array to a character string with same display
useful for printing arrays of rank > 1

fmt................. (v) format numeric matrix, various options

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................ (v) fold text to width

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

hexdump............. (v) show text as hex and ascii characters

nfmt................ (v) 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............... (v) returns formatted ruler

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

sqzint.............. (v) 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.............. (v) 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................ (v) format extended integers

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

system\main\format.ijsRelease: 4.02/1998-11-13/12:26