aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/join.c
blob: 92867205ab86f939f7550eb1063e310cf11d57ec (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·nnmake("", 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;
}