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

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

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

    return s;
}