buffer_compress SYNOPSIS Remove excess whitespace characters from the buffer USAGE Void buffer_compress(white) DESCRIPTION Calls strcompress on the buffer (or region, if defined) SEE ALSO strcompress, get_lines, trim_buffer ----------------------------------- strchop2d SYNOPSIS Chop a string into a 2d-array (lines and columns) USAGE Array strchop2d(str, col_sep='\t', line_sep='\n', quote=0) Array strchop2d(String str, String col_sep, line_sep='\n') DESCRIPTION The 2d equivalent to strchop and strtok. Split the string first into lines (or equivalent with line_sep != '\n') and then into fields. Return the result as a 2d-array with missing values set to NULL The datatype of col_sep determines which function is used to split the lines: if typeof(col_sep) == String_Type, use strtok, else use strchop EXAMPLE strchop2d(bufsubstr, " \t") will return the data in the region interpreted as a white-space delimited table. SEE ALSO strchop, strtok, read_table ----------------------------------- get_table SYNOPSIS Return a 2d-string-array with csv data in the region/buffer USAGE String get_table(col_sep=NULL, kill=0) DESCRIPTION Return a 2d-string-array with the data in the region/buffer The default col_sep==NULL means whitespace (any number of spaces or tabs). The optional argument `kill' tells, whether the table should be deleted after reading. EXAMPLE get_table(" ") columns are separated by single spaces get_table(" | ") columns are separated by space-sourounded bars get_table(NULL) columns are separated by whitespace (default) SEE ALSO strchop2d, format_table, insert_table ----------------------------------- strjoin2d SYNOPSIS Print 2d-array as a nicely formatted table to a string USAGE Str strjoin2d(Array a, col_sep="\t", line_sep="\n", align=NULL) DESCRIPTION The function takes an 2d-array and returns a string that represents the data as an csv-table. It can be seen as a 2d-variant of strjoin(Array_Type a, String_Type delim). SEE ALSO strjoin, strchop2d, insert_table, get_table ----------------------------------- insert_table SYNOPSIS Print 2d-array as a nicely formatted table USAGE Void insert_table(Array a, col_sep=" ", align="l") DESCRIPTION The function takes an 2d-array and writes it as an aligned table. The `col_sep' argument is a string to separate the items on a line, it defaults to " \t" (whitespace). The `align' argument is a string formed of the charaters: "l": left align, "r": right align, "c": center align, or " ": no align (actually every character other than "lrc"), one for each column. If the string is shorter than the number of columns, it will be repeated, i.e. if it contains only one character, the align is the same for all columns) EXAMPLE The call insert_table(a, "|", "llr "); inserts `a' as a table with elements separated by "|" and first and second columns left aligned, third column right aligned and last column not aligned. SEE ALSO get_table, strjoin2d, strjoin ----------------------------------- format_table SYNOPSIS Adjust a table to evenly spaced columns USAGE format_table(col_sep=NULL, align="l", new_sep=col_sep) DESCRIPTION Read a table into a 2d array, reformat and insert again. `col_sep' the string separating columns (defaults to all whitespace) `align' a string formed of the charaters: "l": left align, "r": right align, "c": center align, or " ": no align (actually every character other than "lrc"), one for each column. If the string is shorter than the number of columns, it will be repeated, i.e. if it contains only one character, the align is the same for all columns `new_col_sep' a string to separate the items on a line, SEE ALSO get_table, insert_table -----------------------------------