libcopp 2.3.0
|
字符串相关操作 Licensed under the MIT licenses. More...
#include <stdint.h>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <ostream>
#include <string>
#include <utility>
#include <type_traits>
Go to the source code of this file.
Data Structures | |
struct | util::string::int2str_helper< T > |
Namespaces | |
namespace | util |
namespace | util::string |
Macros | |
#define | __STDC_WANT_LIB_EXT1__ 1 |
#define | UTIL_STRFUNC_STRCASE_CMP(l, r) strcasecmp(l, r) |
#define | UTIL_STRFUNC_STRNCASE_CMP(l, r, s) strncasecmp(l, r, s) |
#define | UTIL_STRFUNC_STRCMP(l, r) strcmp(l, r) |
#define | UTIL_STRFUNC_STRNCMP(l, r, s) strncmp(l, r, s) |
#define | UTIL_STRFUNC_SSCANF(...) sscanf(__VA_ARGS__) |
#define | UTIL_STRFUNC_SNPRINTF(buffer, bufsz, fmt, args...) snprintf(buffer, static_cast<size_t>(bufsz), fmt, ##args) |
#define | UTIL_STRFUNC_VSNPRINTF(buffer, bufsz, fmt, arg) vsnprintf(buffer, static_cast<size_t>(bufsz), fmt, arg) |
Functions | |
template<class TCH = char> | |
TCH | util::string::tolower (TCH c) |
字符转小写 | |
template<class TCH = char> | |
TCH | util::string::toupper (TCH c) |
字符转大写 | |
template<class TCH > | |
bool | util::string::is_space (const TCH &c) |
是否是空白字符 | |
template<class TCH > | |
std::pair< const TCH *, size_t > | util::string::trim (const TCH *str_begin, size_t sz, bool trim_left=true, bool trim_right=true) |
移除两边或一边的空白字符 | |
template<class TCH , class TCHE > | |
void | util::string::reverse (TCH *begin, TCHE end_any) |
翻转字符串 | |
template<class TCH > | |
void | util::string::reverse (TCH *begin, int end_any) |
template<class TCH > | |
void | util::string::reverse (TCH *begin, std::nullptr_t) |
template<class T > | |
size_t | util::string::int2str_unsigned (char *str, size_t strsz, T in) |
template<class T > | |
size_t | util::string::int2str_signed (char *str, size_t strsz, T in) |
template<class T > | |
size_t | util::string::int2str (char *str, size_t strsz, const T &in) |
整数转字符串 | |
template<class T , class TCHAR > | |
const TCHAR * | util::string::str2int (T &out, const TCHAR *str, size_t strsz=0) |
字符串转整数 | |
template<class T , class TCHAR > | |
const TCHAR * | util::string::str2int (T &out, const std::basic_string< TCHAR > &str) |
template<class T , class TINPUT > | |
T | util::string::to_int (TINPUT &&input) |
字符串转整数 | |
template<class TStr , class TCh > | |
void | util::string::hex (TStr *out, TCh c, bool upper_case=false) |
字符转十六进制表示 | |
template<class TStr , class TCh > | |
void | util::string::oct (TStr *out, TCh c) |
字符转8进制表示 | |
template<class TCh > | |
void | util::string::serialization (const void *src, size_t ss, TCh *out, size_t &os) |
字符转8进制表示 | |
template<class Elem , class Traits > | |
void | util::string::serialization (const void *src, size_t ss, std::basic_ostream< Elem, Traits > &out) |
字符转8进制表示 | |
template<class TCh > | |
void | util::string::dumphex (const void *src, size_t ss, TCh *out, bool upper_case=false) |
字符转16进制表示 | |
template<class Elem , class Traits > | |
void | util::string::dumphex (const void *src, size_t ss, std::basic_ostream< Elem, Traits > &out, bool upper_case=false) |
字符转16进制表示 | |
字符串相关操作 Licensed under the MIT licenses.
@history
Definition in file string_oprs.h.
#define __STDC_WANT_LIB_EXT1__ 1 |
Definition at line 18 of file string_oprs.h.
#define UTIL_STRFUNC_SNPRINTF | ( | buffer, | |
bufsz, | |||
fmt, | |||
args... | |||
) | snprintf(buffer, static_cast<size_t>(bufsz), fmt, ##args) |
Definition at line 79 of file string_oprs.h.
#define UTIL_STRFUNC_SSCANF | ( | ... | ) | sscanf(__VA_ARGS__) |
Definition at line 78 of file string_oprs.h.
#define UTIL_STRFUNC_STRCASE_CMP | ( | l, | |
r | |||
) | strcasecmp(l, r) |
Definition at line 56 of file string_oprs.h.
#define UTIL_STRFUNC_STRCMP | ( | l, | |
r | |||
) | strcmp(l, r) |
Definition at line 58 of file string_oprs.h.
#define UTIL_STRFUNC_STRNCASE_CMP | ( | l, | |
r, | |||
s | |||
) | strncasecmp(l, r, s) |
Definition at line 57 of file string_oprs.h.
#define UTIL_STRFUNC_STRNCMP | ( | l, | |
r, | |||
s | |||
) | strncmp(l, r, s) |
Definition at line 59 of file string_oprs.h.
#define UTIL_STRFUNC_VSNPRINTF | ( | buffer, | |
bufsz, | |||
fmt, | |||
arg | |||
) | vsnprintf(buffer, static_cast<size_t>(bufsz), fmt, arg) |
Definition at line 80 of file string_oprs.h.