Mercurial > minori
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/include/string_utils.h Tue Aug 08 19:49:15 2023 -0400 @@ -0,0 +1,33 @@ +#ifndef __string_utils_h +#define __string_utils_h +#include <string> +#include <vector> +namespace StringUtils { + /* Implode function: takes a vector of strings and turns it + into a string, separated by delimiters. */ + std::string Implode(const std::vector<std::string>& vector, + const std::string& delimiter); + std::wstring Implode(const std::vector<std::wstring>& vector, + const std::wstring& delimiter); + + /* Conversion from UTF-8 to std::wstring and vice versa */ + std::string WstrToUtf8(const std::wstring& string); + std::wstring Utf8ToWstr(const std::string& string); + + /* Substring removal functions */ + std::string ReplaceAll(const std::string& string, + const std::string& find, + const std::string& replace); + std::wstring ReplaceAll(const std::wstring& string, + const std::wstring& find, + const std::wstring& replace); + std::string SanitizeLineEndings(const std::string& string); + std::wstring SanitizeLineEndings(const std::wstring& string); + std::wstring RemoveHtmlTags(const std::wstring& string); + std::string RemoveHtmlTags(const std::string& string); + + /* stupid HTML bullshit */ + std::string TextifySynopsis(const std::string& string); + std::wstring TextifySynopsis(const std::wstring& string); +}; +#endif // __string_utils_h \ No newline at end of file