Skip to content

__string_fill_char__

builtin · libnexusinterp/parse-tree/pt-eval-proprietary.cc

: val = __string_fill_char__ ()
: old_val = __string_fill_char__ (new_val)
: old_val = __string_fill_char__ (new_val, "local")

Query or change the character used to pad the rows of a character matrix to a common width.

The current padding character is returned when called with no argument; given new_val a new one is set and the previous character is returned. The value must be a single character, and it defaults to a space (" ").

When strings of unequal length are stacked into a character matrix, the shorter rows are extended with this character so that every row has the same number of columns:

string_fill_char ("X");
[ "these"; "are"; "strings" ]
    ⇒   "theseXX"
        "areXXXX"
        "strings"

Used with the "local" keyword inside a function, the change applies only within that function and the routines it invokes, and the previous character is restored on return.