ofen/include/of_str.h

33 lines
865 B
C
Raw Normal View History

2024-11-14 16:04:54 +08:00
#ifndef OFEN_STRING_HEADER
#define OFEN_STRING_HEADER
#include "of_def.hpp"
2024-12-12 22:42:44 +08:00
#include <vector>
2024-11-14 16:04:54 +08:00
namespace ofen {
class COfStr
{
public:
COfStr();
~COfStr();
2024-12-12 22:42:44 +08:00
public:
static ofString replace(const ofString& str, const ofString& from, const ofString& to);
static std::vector<ofString> split(const ofString& input, const ofString& delimiter);
static ofString trim(const ofString& input);
2025-01-18 19:17:13 +08:00
/// @brief 获取一个添加当前日期后缀的字符串(到秒,如 some.txt => some_20150115151221.txt)。
2025-01-18 19:17:13 +08:00
/// @param name
/// @return
static ofString get_ofile_name(const ofString& name);
2025-01-18 19:17:13 +08:00
static std::string u8_convert(const std::wstring& source);
/// @brief
/// @param source 需要内容为UTF-8格式。
/// @return
static std::wstring u8_convert(const std::string& source);
2024-11-14 16:04:54 +08:00
};
}; // namespace ofen
#endif