module Kwformat:sig..end
val j : string -> string list -> string
Nand's format::j.
Bug: right now "blank" is defined as just "" rather than nand's "whitespace".
Returns string of list elements joined together, omitting "blanks"
sep : string to use as separatorval commafy : ?comma:string -> int -> string
E.g.: (commafy 12021457) = "12,021,457"
Returns formatted string
comma : string to use as comma; default: ","n : number to convertval commafylist : ?comma:string -> ?n:int -> string -> stringcommafylist ?comma ?n str: add commas to a string, presumably of digits
Useful for bignums, etc.
E.g.: (commafy "12021457") = "12,021,457"
Returns commafied string
comma : string to use as comma; default: ","n : how man digits in comma groupval columnate : ?header:string list ->
?bar:char ->
?sep:string ->
?maxwidth:int -> ?widths:int list -> string list list -> string listcolumnate ?header ?bar ?sep ?maxwidth ?widths matrix: format a list of lists of strings in neat columns
Formats a "matrix" of strings e.g.:
[["footstep"; "obovoid"; "suitor"]
;["fibration"; "triadist"; "homeochronous"]
;["similitude"; "hackberry"; "undignifiedly"]
]
into a list of strings, each of which represents a row of the matrix, with the items padded out so that you have equal width columns when printed, e.g. via:
List.iter print_endline (columnate matrix)
Raises Invalid_argument if matrix is non-rectangular
header : a list of strings to use as column labels; will be added as the first line of the resultsep : string that separates columns (default: " ")maxwidth : maximum width of line; longer lines will be
truncated on the right (default: None)widths : list item i is the max allowable width of
column i; if the actual column is larger, it is truncated to this width;
but if the integer is negative, it is ignored i.e. the actual computed
max column width is used for this column; widths can be shorter than
the actual number of columns; missing columns get their computed max width
(default: [])matrix : list of list of stringsval digits : ?base:int -> int -> intn require in base b?base : base (currently restricted to 10)n : numberval plural : ?plural:string -> ?suffix:string -> string -> int -> stringOnly works for languages like English, with a simple plural suffix and occasional exceptions.
Examples:
# List.map (fun n -> n,plural "cat" n) (~-1--2);; \- [(-1, "cats"); (0, "cats"); (1, "cat"); (2, "cats")] # List.map (fun n -> n,plural ~plural:"oxen" "ox" n) (~-1--2);; \- [(-1, "oxen"); (0, "oxen"); (1, "ox"); (2, "oxen")] #
plural : the plural of noun, when noun is irregularsuffix : the plural suffix for regular nouns (default: "s")noun : the noun in questionn : the quantitymodule Units:sig..end