Proton  1.1.1
Make porting easy from Python to C++11
proton::basic_string_< CharT, Traits, Allocator > Class Template Reference

main string template More...

#include <proton/string.hpp>

Inherits std::basic_string< Char >.

List of all members.

Public Member Functions

template<typename... argT>
 basic_string_ (argT &&...a)
 forwarding ctor.
 basic_string_ (std::initializer_list< CharT > a)
 initializer_list forwarding ctor.
 basic_string_ (const basic_string_ &x)
 copy ctor.
 basic_string_ (basic_string_ &&x) noexcept
 move ctor.
basic_string_operator= (const basic_string_ &x)
 assign.
template<typename argT >
basic_string_operator+= (argT &&a)
 +=
template<typename argT >
basic_string_ operator+ (argT &&a)
 string + string
template<typename V >
basic_string_ operator% (const V &a)
 string % V
 operator baseT & ()
 cast to std::basic_string<>&.
template<typename A1 >
 operator std::basic_string< CharT, Traits, A1 > () const
 cast to std::basic_string<>&.
CharT & operator[] (offset_t i)
 [i] in python
const CharT & operator[] (offset_t i) const
 [i] in python
basic_string_ operator() (offset_t i) const
 slice of [i:]
basic_string_ operator() (offset_t i, offset_t j) const
 slice of [i:j]
basic_string_ operator() (offset_t i, offset_t j, size_t k) const
 slice of [i:j:k]
size_t count (const CharT &x) const
 total number of occurences of a char.
offset_t index (const CharT &val) const
 index of the first occurence of a char.
basic_string_ strip (const baseT &spc=detail::vals< CharT >::ws) const
 Return a copy of the string with leading and trailing characters removed.
deque_< basic_string_split (const baseT &delim=baseT(), int null_unite=-1) const
 split a string.
template<typename string_list >
basic_string_ join (const string_list &r) const
 join a list of strings to one string.
template<typename str2 >
bool startswith (str2 &&sub) const
 startswith.
template<typename str2 >
bool istartswith (str2 &&sub) const
 case-insensitive startswith.
template<typename str2 >
bool endswith (str2 &&sub) const
 endswith.
template<typename str2 >
bool iendswith (str2 &&sub) const
 case-insensitive endswith.
basic_string_ lower () const
 return a copy with upper case letters converted to lower case.
basic_string_ upper () const
 return a copy with lower case letters converted to upper case.

Detailed Description

template<class CharT, class Traits, class Allocator>
class proton::basic_string_< CharT, Traits, Allocator >

main string template

Examples:
string.cpp.

Definition at line 558 of file string.hpp.


Member Function Documentation

template<class CharT, class Traits, class Allocator>
offset_t proton::basic_string_< CharT, Traits, Allocator >::index ( const CharT &  val) const
inline

index of the first occurence of a char.

Parameters:
valthe char.
Exceptions:
std::invalid_argumentif there is no such a char.
Examples:
string.cpp.

Definition at line 768 of file string.hpp.

template<class CharT, class Traits, class Allocator>
template<typename string_list >
basic_string_ proton::basic_string_< CharT, Traits, Allocator >::join ( const string_list &  r) const
inline

join a list of strings to one string.

Parameters:
rthe input string list
Returns:
the output string

Definition at line 851 of file string.hpp.

template<class CharT, class Traits, class Allocator>
deque_<basic_string_ > proton::basic_string_< CharT, Traits, Allocator >::split ( const baseT &  delim = baseT(),
int  null_unite = -1 
) const
inline

split a string.

Parameters:
delimthe delimiters
null_unite-1: a.c.t. python depent on token, 0: false, 1: true
Returns:
the output string list, in deque_<basic_string_>
Examples:
string.cpp.

Definition at line 798 of file string.hpp.

template<class CharT, class Traits, class Allocator>
basic_string_ proton::basic_string_< CharT, Traits, Allocator >::strip ( const baseT &  spc = detail::vals<CharT>::ws) const
inline

Return a copy of the string with leading and trailing characters removed.

Parameters:
spcwhite space chars
Returns:
the stripped string
Examples:
string.cpp.

Definition at line 781 of file string.hpp.


The documentation for this class was generated from the following file: