| 1 | // LAF Base Library |
| 2 | // Copyright (c) 2020-2022 Igara Studio S.A. |
| 3 | // Copyright (c) 2001-2017 David Capello |
| 4 | // |
| 5 | // This file is released under the terms of the MIT license. |
| 6 | // Read LICENSE.txt for more information. |
| 7 | |
| 8 | #ifndef BASE_STRING_H_INCLUDED |
| 9 | #define BASE_STRING_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include <cstdarg> |
| 13 | #include <iterator> |
| 14 | #include <string> |
| 15 | |
| 16 | namespace base { |
| 17 | |
| 18 | std::string string_printf(const char* format, ...); |
| 19 | std::string string_vprintf(const char* format, std::va_list ap); |
| 20 | |
| 21 | std::string string_to_lower(const std::string& original); |
| 22 | std::string string_to_upper(const std::string& original); |
| 23 | |
| 24 | std::string to_utf8(const wchar_t* src, const int n); |
| 25 | |
| 26 | inline std::string to_utf8(const std::wstring& widestring) { |
| 27 | return to_utf8(widestring.c_str(), (int)widestring.size()); |
| 28 | } |
| 29 | |
| 30 | std::wstring from_utf8(const std::string& utf8string); |
| 31 | |
| 32 | int utf8_length(const std::string& utf8string); |
| 33 | int utf8_icmp(const std::string& a, const std::string& b, int n = 0); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | #endif |
| 38 | |