Header:
|
plang/factor/string_.hpp
|
Class:
|
string<char> : factor, string<wchar_t> : factor
|
string
is built-in data type represents character string. In C++ code boost::shared_ptr<string_<char_t>>
is class corresponding to string.
string_<char_t> has std::basic_string<char_t> type member named val which holds value of that
object.
Members
Methods
string()
default constructor, set val to ""
effects
val=""
template<class
T> string(T& x)
constructors includes copy constructor,
set val to x
parameters
T& x
T must be castable to string
effects
val=string(x)
operator bool()
bad casting methods to bool
exceptions
bad_cast - always throw
bool empty()
test if string is empty, i.e. whether size() is 0
returns
val.empty()
unsigned int size()
get length of string
returns
val.size()
string at(unsigned int i)
get the character at position i in val
parameters
unsigned int i
position starting from 0 to size()-1
out of range occurs if i >= size()
returns
val.at(i)
exceptions
range_error - if i >= size()
bool match(string expr)
test if val matches regular expression expr
parameters
string expr - string represents regular expression
returns
regex(expr).match(val)