aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/StringHelpers.h
blob: dee676bae8efa8f2309ffd0e64f855d23cab9964 (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
28
29
30
31
32
33
34
35
#pragma once
using namespace std;

wstring toLower(const wstring& a);
wstring trimString(const wstring& a);
wstring replaceAll(const wstring& in, const wstring& replace, const wstring& with);

bool equalsIgnoreCase(const wstring& a, const wstring& b);

template <class T> T _fromString(const std::wstring& s)
{
	std::wistringstream stream (s);
	T t;
	stream >> t;
	return t;
}
template <class T> T _fromHEXString(const std::wstring& s)
{
	std::wistringstream stream (s);
	T t;
	stream >> std::hex >> t;
	return t;
}

wstring convStringToWstring(const string& converting);
const char *wstringtofilename(const wstring& name);
const char *wstringtochararray(const wstring& name);
wstring filenametowstring(const char *name);

std::vector<std::wstring> &stringSplit(const std::wstring &s, wchar_t delim, std::vector<std::wstring> &elems);
std::vector<std::wstring> stringSplit(const std::wstring &s, wchar_t delim);

void stripWhitespaceForHtml(wstring &string, bool bRemoveNewline=true);
wstring escapeXML(const wstring &in);
wstring parseXMLSpecials(const wstring &in);