|
Console Library 4.7.0
A header-only library that makes C++ simple
|
提供字符串处理工具函数和格式化类。 More...
#include <string>#include <vector>#include <algorithm>#include <cctype>#include <sstream>#include <initializer_list>#include <utility>#include <cstdint>#include "output.h"#include "csexc.h"Go to the source code of this file.
Classes | |
| struct | console::PartitionResult |
| 字符串分区结果,包含左部分、分隔符、右部分。 More... | |
| class | console::f_string |
| 格式化字符串类,支持使用 % 运算符进行占位符 {} 替换。 More... | |
Namespaces | |
| namespace | console |
| 本库所有组件所在的顶层命名空间。 | |
Functions | |
| std::string | console::ltrim (std::string str) |
| 移除字符串左侧的空白字符(空格、制表符等)。 | |
| std::string | console::rtrim (std::string str) |
| 移除字符串右侧的空白字符。 | |
| std::string | console::trim (std::string str) |
| 移除字符串两侧的空白字符。 | |
| std::string | console::ltrim (std::string str, const std::string &chars) |
| 移除字符串左侧指定的字符集合。 | |
| std::string | console::rtrim (std::string str, const std::string &chars) |
| 移除字符串右侧指定的字符集合。 | |
| std::string | console::trim (std::string str, const std::string &chars) |
| 移除字符串两侧指定的字符集合。 | |
| std::string | console::upper (std::string str) |
| 将字符串转换为大写。 | |
| std::string | console::lower (std::string str) |
| 将字符串转换为小写。 | |
| std::string | console::title (std::string str) |
| 将字符串转换为标题格式(每个单词首字母大写,其余小写)。 | |
| PartitionResult | console::partition (const std::string &text, const std::string &sep) |
| 在字符串中查找第一个分隔符,并返回分隔符之前、分隔符本身、分隔符之后的三部分。 | |
| std::vector< std::string > | console::split (std::string text, const std::string &sep=" ") |
| 以分隔符分割字符串(类似 Python 的 split,默认按空格分割)。 | |
| template<class T> | |
| std::string | console::join (const std::vector< T > &vec, const std::string &sep="") |
| 以分隔符连接容器中的字符串元素。 | |
| template<class... Args> | |
| std::string | console::uni_to_str (Args &&...args) |
| 将任意多个参数转换为字符串并拼接(无分隔符)。 | |
提供字符串处理工具函数和格式化类。
包含去除空白字符、大小写转换、分割与连接、分区、可变参数转字符串、格式化字符串(f_string)等功能。