summaryrefslogtreecommitdiff
path: root/kms++util/src/strhelpers.cpp
blob: f59bb6da8519393f2b0b46daac5ca8016329f533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <kms++util/strhelpers.h>

#include <algorithm>
#include <stdarg.h>

using namespace std;

string to_lower(const string& str)
{
	string data = str;
	transform(data.begin(), data.end(), data.begin(), ::tolower);
	return data;
}

string sformat(const char *fmt, ...)
{
	static char s_format_buf[1024];

	va_list args;
	va_start(args, fmt);

	vsnprintf(s_format_buf, sizeof(s_format_buf), fmt, args);

	va_end(args);

	return string(s_format_buf);
}