mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
* empty * docs: flesh out 31 TBW efun reference pages Replace the placeholder "TBW" DESCRIPTION and type-only SYNOPSIS in 31 efun docs with real descriptions and named parameters, verified against the driver source: - math (general/): log10, log2, norm, dotprod, distance, angle - matrix (general/): id_matrix, translate, scale, rotate_x/y/z, lookat_rotate, lookat_rotate2 -- note the in-place mutation of the passed matrix and that rotations are in degrees - compress (general/): compress, uncompress, compress_file, uncompress_file -- note the file variants delete the source on success - interactive/: send_zmp, act_mxp, request_term_type, start_request_term_type, request_term_size - internals/: dump_trace, destructed_objects, check_memory (flag bitmask + DEBUGMALLOC build requirement), dump_stralloc, dump_jemalloc - core: next_bit, explode_reversible, shallow_inherit_list Each page keeps the existing manpage-style layout (4-space-indented NAME/SYNOPSIS/DESCRIPTION, name(3) SEE ALSO). Example blocks are indented to match, so all files are markdownlint-clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1.2 KiB
1.2 KiB
| title |
|---|
| general / explode_reversible |
explode_reversible
NAME
explode_reversible() - split a string on a delimiter without losing empty tokens
SYNOPSIS
string *explode_reversible(string str, string delimiter);
DESCRIPTION
Splits `str` into an array of substrings on each occurrence of
`delimiter`, exactly like explode(), but losslessly: it keeps the empty
tokens that plain explode() discards. Empty pieces produced by a leading
delimiter, a trailing delimiter, or two adjacent delimiters are all
preserved as empty strings in the result.
Because no information is dropped, the split is exactly reversible:
implode(explode_reversible(str, delimiter), delimiter) == str
holds for any `str` and any non-empty `delimiter`. Use this when you need
to round-trip a string through a split/join cycle unchanged, where
explode()'s pruning of empty fields would corrupt the data.
EXAMPLE
string *parts = explode_reversible("a,,b,", ",");
// parts == ({ "a", "", "b", "" })
// implode(parts, ",") == "a,,b,"
explode("a,,b,", ",");
// ({ "a", "b" }) -- empty fields dropped, not reversible
SEE ALSO
explode(3), implode(3)