libcopp  1.1.0
Namespaces | Macros | Functions
string_oprs.h File Reference

字符串相关操作 Licensed under the MIT licenses. More...

#include <stdint.h>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <ostream>
Include dependency graph for string_oprs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 util
 
 util::string
 

Macros

#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(...)   snprintf(__VA_ARGS__)
 
#define UTIL_STRFUNC_VSNPRINTF(buffer, bufsz, fmt, arg)   vsnprintf(buffer, static_cast<int>(bufsz), fmt, arg)
 

Functions

template<typename TCH = char>
static TCH util::string::tolower (TCH c)
 字符转小写 More...
 
template<typename TCH = char>
static TCH util::string::toupper (TCH c)
 字符转大写 More...
 
template<typename T >
void util::string::str2int (T &out, const char *str)
 字符串转整数 More...
 
template<typename T >
util::string::to_int (const char *str)
 字符串转整数 More...
 
template<typename TStr , typename TCh >
void util::string::hex (TStr *out, TCh c, bool upper_case=false)
 字符转十六进制表示 More...
 
template<typename TStr , typename TCh >
void util::string::oct (TStr *out, TCh c)
 字符转8进制表示 More...
 
template<typename TCh >
void util::string::serialization (const void *src, size_t ss, TCh *out, size_t &os)
 字符转8进制表示 More...
 
template<typename Elem , typename Traits >
void util::string::serialization (const void *src, size_t ss, std::basic_ostream< Elem, Traits > &out)
 字符转8进制表示 More...
 
template<typename TCh >
void util::string::dumphex (const void *src, size_t ss, TCh *out, bool upper_case=false)
 字符转16进制表示 More...
 
template<typename Elem , typename Traits >
void util::string::dumphex (const void *src, size_t ss, std::basic_ostream< Elem, Traits > &out, bool upper_case=false)
 字符转16进制表示 More...
 

Detailed Description

字符串相关操作 Licensed under the MIT licenses.

Version
1.0
Author
owent
Date
2015.11.24

Definition in file string_oprs.h.

Macro Definition Documentation

#define UTIL_STRFUNC_SNPRINTF (   ...)    snprintf(__VA_ARGS__)

Definition at line 56 of file string_oprs.h.

#define UTIL_STRFUNC_SSCANF (   ...)    sscanf(__VA_ARGS__)

Definition at line 55 of file string_oprs.h.

#define UTIL_STRFUNC_STRCASE_CMP (   l,
 
)    strcasecmp(l, r)

Definition at line 36 of file string_oprs.h.

#define UTIL_STRFUNC_STRCMP (   l,
 
)    strcmp(l, r)

Definition at line 38 of file string_oprs.h.

#define UTIL_STRFUNC_STRNCASE_CMP (   l,
  r,
 
)    strncasecmp(l, r, s)

Definition at line 37 of file string_oprs.h.

#define UTIL_STRFUNC_STRNCMP (   l,
  r,
 
)    strncmp(l, r, s)

Definition at line 39 of file string_oprs.h.

#define UTIL_STRFUNC_VSNPRINTF (   buffer,
  bufsz,
  fmt,
  arg 
)    vsnprintf(buffer, static_cast<int>(bufsz), fmt, arg)

Definition at line 57 of file string_oprs.h.