blob: 1e0d91725a6a0e1d92d53963f5fca41103e27f70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "internal.h"
// makef returns a new dynamic string object
string
string·makef(byte *fmt, ...)
{
vlong n;
string s;
va_list args;
char bytes[256];
s = string·makecap(nil, 0, arrlen(bytes));
va_start(args, fmt);
do{
n = fmt·vnsprint(bytes, arrlen(bytes), fmt, args);
string·append(&s, bytes);
}while(n==arrlen(bytes));
va_end(args);
return s;
}
|