Jive reference manual
|
Helps the String class converting various types of strings. More...
#include <jem/base/String.h>
Public Member Functions | |
BasicString (const char *str) | |
Character array conversion constructor. More... | |
BasicString (const char *str, int n) | |
String conversion constructor. More... | |
BasicString (const String &str) | |
String conversion constructor. More... | |
char | operator[] (int i) const |
BasicString subscript operator. More... | |
int | size () const |
Returns the size of this BasicString . More... | |
The BasicString
class is used by the String
class to convert null-terminated character arrays and String
objects to a common representation. It is a light-weight class that contains just a pointer to a character array and an integer specifying the length of that array. The instantiation of a BasicString
object is therefore a cheap operation.
This class is normally instantiated implicitly by the compiler using one of the conversion constructors.
jem::BasicString::BasicString | ( | const char * | str | ) |
Creates a BasicString
from a null-terminated character array
str | - a null-terminated character array or NULL . |
jem::BasicString::BasicString | ( | const char * | str, |
int | n | ||
) |
Creates a BasicString
from the first n elements in the character array str.
str | - a null-terminated character array of length n. If n is zero, str may be NULL . |
n | - the length of the character array str. |
n >= 0
this->size() == n
jem::BasicString::BasicString | ( | const String & | str | ) |
Creates a BasicString
from the String
str.
str | - a String object. |
this->size() == str.size()
char jem::BasicString::operator[] | ( | int | i | ) | const |
Returns the i-th character of this BasicString.
i | - the character index. |
BasicString
.i >= 0 && i < this->size()
int jem::BasicString::size | ( | ) | const |
BasicString
.