comparison src/include/string_utils.h @ 1:1ae666fdf9e2

*: initial commit
author Paper <mrpapersonic@gmail.com>
date Tue, 08 Aug 2023 19:49:15 -0400
parents
children 23d0d9319a00
comparison
equal deleted inserted replaced
0:5a76e1b94163 1:1ae666fdf9e2
1 #ifndef __string_utils_h
2 #define __string_utils_h
3 #include <string>
4 #include <vector>
5 namespace StringUtils {
6 /* Implode function: takes a vector of strings and turns it
7 into a string, separated by delimiters. */
8 std::string Implode(const std::vector<std::string>& vector,
9 const std::string& delimiter);
10 std::wstring Implode(const std::vector<std::wstring>& vector,
11 const std::wstring& delimiter);
12
13 /* Conversion from UTF-8 to std::wstring and vice versa */
14 std::string WstrToUtf8(const std::wstring& string);
15 std::wstring Utf8ToWstr(const std::string& string);
16
17 /* Substring removal functions */
18 std::string ReplaceAll(const std::string& string,
19 const std::string& find,
20 const std::string& replace);
21 std::wstring ReplaceAll(const std::wstring& string,
22 const std::wstring& find,
23 const std::wstring& replace);
24 std::string SanitizeLineEndings(const std::string& string);
25 std::wstring SanitizeLineEndings(const std::wstring& string);
26 std::wstring RemoveHtmlTags(const std::wstring& string);
27 std::string RemoveHtmlTags(const std::string& string);
28
29 /* stupid HTML bullshit */
30 std::string TextifySynopsis(const std::string& string);
31 std::wstring TextifySynopsis(const std::wstring& string);
32 };
33 #endif // __string_utils_h