string type. More...
#include <types.h>
Classes | |
class | iterator |
iterator type for string_t . More... | |
Public Member Functions | |
string_t () | |
constructs an empty string. | |
string_t (const char *b, const char *e) | |
constructs a string with the given begin and end pointers. | |
string_t (const char *s) | |
constructs a string with the given char * interpreted as a C-style string. | |
string_t (const char *s, int len) | |
constructs a string with the given pointer and length. | |
string_t (const string_t &x) | |
constructs a copy of a given string. More... | |
string_t & | operator= (const string_t x) |
assigns this string to the given string. More... | |
string_t & | assign (const char *b, const char *e) |
assigns this string to the given sequence. More... | |
unsigned int | length () const |
returns the size of the string. | |
const char & | operator[] (int x) const |
accessor method for strings. | |
bool | operator== (const string_t &x) const |
equality test for strings. | |
bool | operator< (const string_t &x) const |
lexicographical order relation. More... | |
bool | operator> (const string_t &x) const |
lexicographical order relation. More... | |
bool | operator!= (const string_t &x) const |
not equals | |
bool | has_prefix (const string_t &x) const |
prefix | |
bool | has_suffix (const string_t &x) const |
suffix | |
bool | has_substring (const string_t &x) const |
substring | |
Public Attributes | |
const char * | begin |
pointer to the first character in the string. | |
const char * | end |
pointer to the first character past-the-end of the string. | |
string type.
a string is contiguous sequence of 8-bit characters. The sequence is defined by a pair of pointers. The first pointer begin
points to the first character; the second pointer end
points to the first charcter past the end of the sequence. A string may contain any character. A string may also be empty (when begin == end
.)
string_t
s are immutable strings, in the sense that string_t
does not provide methods to modify the value of a string_t
.
|
inline |
constructs a copy of a given string.
The copy is simply a copy of the reference. In other words, this method does not allocate memory for the string value. Instead, the new string will point to the same sequence of the given string.
|
inline |
|
inline |
|
inline |
lexicographical order relation.
returns true iff this string lexicographically follows the given string.