summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index ef3d511c..1b9fefa9 100644
--- a/lib.c
+++ b/lib.c
@@ -4223,6 +4223,41 @@ val scat(val sep, ...)
return ret;
}
+val scat2(val s1, val s2)
+{
+ struct cat_str cs;
+
+ cat_str_init(&cs, nil, NULL);
+
+ cat_str_measure(&cs, s1, 1);
+ cat_str_measure(&cs, s2, 0);
+
+ cat_str_alloc(&cs);
+
+ cat_str_append(&cs, s1, 1);
+ cat_str_append(&cs, s2, 0);
+
+ return cat_str_get(&cs);
+}
+
+val scat3(val s1, val sep, val s2)
+{
+ struct cat_str cs;
+ wchar_t onech[] = wini(" ");
+
+ cat_str_init(&cs, sep, onech);
+
+ cat_str_measure(&cs, s1, 1);
+ cat_str_measure(&cs, s2, 0);
+
+ cat_str_alloc(&cs);
+
+ cat_str_append(&cs, s1, 1);
+ cat_str_append(&cs, s2, 0);
+
+ return cat_str_get(&cs);
+}
+
val fmt_join(struct args *args)
{
cnum index;