aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/join.c
blob: fb97b6cbad7b0f7754d0d0083a8c48054608935e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "internal.h"

string
str·join(vlong len, byte** fields, const byte* sep)
{
    string s = str·makecap("", 0, 10);
    int    j = 0;

    for (j = 0; j < len; j++) {
        str·append(&s, fields[j]);
        if (j < len - 1) 
            str·appendlen(&s, 1, sep);
    }

    return s;
}