6 * tal/str - string helper routines which use tal
8 * This is a grab bag of functions for string operations, designed to enhance
9 * the standard string.h; these are separated from the non-tal-needing
10 * string utilities in "str.h". Each string created by this library
11 * will have tal_count() equal to strlen() + 1 (assuming you didn't create
12 * a string containing a NUL, such as using tal_fmt("%c", 0)).
15 * #include <ccan/tal/str/str.h>
16 * #include <ccan/tal/grab_file/grab_file.h>
19 * // Dumb demo program to double-linespace a file.
20 * int main(int argc, char *argv[])
26 * errx(1, "Takes 0 or 1 arguments");
27 * // Grab lines in file.
28 * textfile = grab_file(NULL, argv[1]);
30 * err(1, "Failed reading %s", argv[1]);
31 * lines = tal_strsplit(textfile, textfile, "\n", STR_EMPTY_OK);
33 * // Join them back together with two linefeeds.
34 * printf("%s", tal_strjoin(textfile, lines, "\n\n", STR_TRAIL));
36 * // Free everything, just because we can.
42 * Author: Rusty Russell <rusty@rustcorp.com.au>
44 int main(int argc, char *argv[])
49 if (strcmp(argv[1], "depends") == 0) {
52 printf("ccan/tal/talloc\n");
56 printf("ccan/take\n");