|
dl
|
字符串相关 更多...
#include <array>#include <string>#include <system_error>#include <charconv>#include <fmt/format.h>#include "memory/dl_code_cvt.h"#include "dl_range.h"#include "math/dl_algorithm.h"#include "io/dl_log.h"#include "base/dl_type_def.h"#include "base/dl_vector2.h"#include "base/dl_array2.h"#include "memory/dl_buffer.h"类 | |
| struct | dl::string_hash |
| struct | fmt::formatter< dl::Array< T, 2 > > |
| struct | fmt::formatter< dl::Array< T, 3 > > |
| struct | fmt::formatter< dl::Array< T, 4 > > |
| struct | fmt::formatter< dl::StringN< N > > |
命名空间 | |
| namespace | dl |
| namespace | dl::String |
| 字符串操作 | |
| namespace | fmt |
枚举 | |
| enum class | dl::StringType { dl::NORMAL , dl::INTGER , dl::FLOAT } |
函数 | |
| std::string & | dl::operator+= (std::string &a, std::string_view b) |
| std::string | dl::operator+ (const std::string &a, std::string_view b) |
| std::string | dl::operator+ (std::string_view a, std::string_view b) |
| template<IsBase T> | |
| std::string | dl::to_string (T v) |
| to_string包装 | |
| std::string | dl::to_string (const std::string &str) |
| template<typename T, size_t N> | |
| std::string | dl::to_string (const std::array< T, N > &arr, std::string_view delimiter=", ") |
| array通用to_string | |
| template<typename T, size_t N> | |
| std::string | dl::to_string (const Array< T, N > &arr, std::string_view delimiter=", ") |
| template<typename T, size_t N> | |
| std::string | dl::to_string (const ArrayS2< T, N > &arr, std::string_view delimiter=", ") |
| template<typename T> | |
| std::string | dl::to_string (const std::vector< T > &vec, std::string_view delimiter=", ") |
| vector通用to_string | |
| std::string | dl::to_string (std::error_code code) |
| 错误码信息 | |
| std::string | dl::to_string (std::exception &e) |
| 异常信息 | |
| std::string | dl::to_string (BufferView buf) |
| buf转为utf8字符串(不进行检查) | |
| std::string | dl::to_string (const Buffer &buf) |
| std::string | dl::to_string_check (BufferView buf, bool tips=true) |
| buf转为utf8字符串(进行检查) | |
| std::string | dl::to_string_hex (BufferView buf, bool upper=false, bool add_tag=false) |
| buf转为16进制字符串 | |
| template<size_t N> | |
| std::string | dl::to_string_hex (const std::array< std::byte, N > &buf, bool upper=false, bool add_tag=false) |
| buf转为16进制字符串 | |
| std::string | dl::to_string_auto (BufferView buf, bool add_tag=false) |
| buf转为字符串,若不为utf8则转为16进制 | |
| Float | dl::String::toFloat (std::string_view str, Float default_v=0) |
| 字符串 -> Float | |
| bool | dl::String::IsBlank (char ch) |
| 字符串为空白字符,一般意义上( \t空格) | |
| std::vector< std::string_view > | dl::String::ToView (const std::vector< std::string > &a) |
| 转换为 std::vector<std::string_view> | |
| bool | dl::String::IsBlank (std::string_view str) |
| 字符串为空白(全为 \t空格) | |
| std::string_view | dl::String::EraseBlankBoth (std::string_view str) |
| 字符串删除首尾空字符 | |
| int | dl::String::toInt (std::string_view str, int default_v=0) |
| 转为整数,失败返回设定的默认值 | |
| unsigned | dl::String::toUint (std::string_view str, unsigned default_v=0) |
| int64_t | dl::String::toInt64 (std::string_view str, int64_t default_v=0) |
| 转为整数,失败返回设定的默认值 | |
| bool | dl::String::getInt (std::string_view str, int &ret) |
| 转为整数,失败不修改原值 | |
| bool | dl::String::toBool (std::string_view str, bool default_v=false) |
| 字符串 -> bool | |
| bool | dl::String::getByte (std::string_view str, std::byte &ret) |
| 转为单个字节,需要十六进制,失败不修改原值 | |
| template<std::size_t N> | |
| Array< int, N > | dl::String::toPoint (std::string_view str, char d=',') |
| 字符串 -> Point | |
| template<std::size_t N> | |
| Array< Float, N > | dl::String::toPosition (std::string_view str, char d=',') |
| 字符串 -> Position | |
| Point2 | dl::String::toPoint2 (std::string_view str, char d=',') |
| Position | dl::String::toPosition2 (std::string_view str, char d=',') |
| constexpr StringType | dl::String::GetType (std::string_view str) |
| 返回字符串类型 | |
| std::string | dl::String::AddQuotes (std::string_view str, char quotes='\"') |
| 两侧添加引号 | |
| size_t | dl::String::Wcwidth (wchar_t ch) |
| 获取宽字符宽度(控制台显示优化) | |
| std::string | dl::String::FillEndl (std::string_view str, char ch=' ') |
| 多行文本填充字符至一样宽(控制台显示优化) | |
| constexpr std::string_view | dl::String::GetNotFileName () |
| 返回不能作为文件名的字符 | |
| std::string | dl::to_string (const Vector2< std::string > &vec2) |
字符串相关
在文件 dl_string.h 中定义.