Proton  1.1.1
Make porting easy from Python to C++11
str

like string in python. More...

Namespaces

namespace  proton::detail
 The implementation namespace of proton.

Classes

class  proton::basic_string_< CharT, Traits, Allocator >
 main string template More...

Typedefs

typedef basic_string_< char > proton::str
 the main string type in proton.
typedef basic_string_< wchar_t > proton::wstr
 the main wstring type in proton.

Functions

template<typename string_list , typename string >
void proton::split (string_list &r, const string &s, string spc="", int null_unite=-1)
 split a string.
template<typename string_list >
string_list::value_type proton::join (const char *token, const string_list &r)
 join a list of strings to one string.
template<typename string , typename T >
string proton::to_ (T &&n, int base=10)
 convert a number/object to a string.
template<typename int_t , typename string >
bool proton::get_int (int_t &r, const string &s, int base=10)
 get integer (including int/long/unsigned and so on) from string.
template<typename T , typename C , typename A >
basic_string_< T, C, A > proton::operator+ (const T *s, basic_string_< T, C, A > &t)
 const CharT* + str
template<typename C , typename V >
basic_string_< C,
std::char_traits< C >
, smart_allocator< C > > 
proton::operator% (const C *f, const V &a)
 const CharT* % V
template<typename T , typename C , typename A >
basic_string_< T, C, A > proton::operator* (const basic_string_< T, C, A > &s, size_t n)
 string * n
template<typename T , typename C , typename A >
basic_string_< T, C, A > proton::operator* (size_t n, const basic_string_< T, C, A > &s)
 n * string
template<typename T , typename C , typename A >
basic_string_< T, C, A > & proton::cast_ (std::basic_string< T, C, A > &x)
 cast to proton::basic_string_<>& from std::basic_string<>&.

Detailed Description

like string in python.


Function Documentation

template<typename int_t , typename string >
bool proton::get_int ( int_t &  r,
const string &  s,
int  base = 10 
)

get integer (including int/long/unsigned and so on) from string.

Parameters:
rthe output value
sthe input string
base10:dec, 16:hex
Returns:
true: success, false: failure

Definition at line 178 of file string.hpp.

template<typename string_list >
string_list::value_type proton::join ( const char *  token,
const string_list &  r 
)

join a list of strings to one string.

Parameters:
tokenthe delimiter
rthe input string list
Returns:
the output string

Definition at line 102 of file string.hpp.

template<typename string_list , typename string >
void proton::split ( string_list &  r,
const string &  s,
string  spc = "",
int  null_unite = -1 
)

split a string.

Parameters:
rthe output string list, supporting clear() and push_back()
sthe input string
spcthe delimiters
null_unite-1: a.c.t. python depent on token, 0: false, 1: true

Definition at line 44 of file string.hpp.

template<typename string , typename T >
string proton::to_ ( T &&  n,
int  base = 10 
)

convert a number/object to a string.

Parameters:
nthe input value
base10:dec, 16:hex
Returns:
the output string

Definition at line 164 of file string.hpp.