Intrinsic string type.
More...
#include <zbl.hpp>
List of all members.
Classes |
class | creator |
| string creator More...
|
Public Member Functions |
| string () |
| Default constructor.
|
| string (const char *val) |
| Constructor.
|
| string (const QString &val) |
| Constructor.
|
string & | operator= (const char *val) |
| Assignment.
|
string & | operator= (const string &val) |
| Assignment.
|
string & | operator+= (const int &chr) |
| Append.
|
string & | operator+= (const string &src) |
| Append.
|
string & | operator+= (const char *src) |
| Append.
|
bool | operator== (const string &src) const |
| Equality comparison.
|
bool | operator== (const char *src) const |
| Equality comparison.
|
bool | operator!= (const string &src) const |
| Inequality comparison.
|
bool | operator!= (const char *src) const |
| Inequality comparison.
|
bool | operator< (const string &src) const |
| Check if less-than.
|
string | operator+ (const string &src) const |
| Add two strings.
|
string | operator+ (const char *src) const |
| Add two strings.
|
int | at (const int &idx) const |
| Return character at specified index.
|
bool | has (const int &ch) const |
| Checks if character is present in the string.
|
int | find (const z::string &sub) const |
| Find substring in the string.
|
string | mid (const int &start, const int &len=-1) const |
| Return substring of the string.
|
long | toLong () const |
| Convert string to long.
|
string | leftJustified (const int &w) const |
| Left-justify string to specified width.
|
int | length () const |
| Get length of the string.
|
void | replace (const int &ch, const int &with) |
| Replace a character with another in string.
|
const char * | toUtf8 (char buf[], const int &len) const |
| Convert string to UTF8.
|
QString & | get () const |
| Returns the stored value.
|
Private Attributes |
QString | _val |
| The value.
|
Detailed Description
Constructor & Destructor Documentation
string |
( |
const char * |
val | ) |
[inline] |
string |
( |
const QString & |
val | ) |
[inline, explicit] |
Member Function Documentation
int at |
( |
const int & |
idx | ) |
const [inline] |
Return character at specified index.
- Parameters:
-
- Returns:
- Character at specified index
int find |
( |
const z::string & |
sub | ) |
const [inline] |
Find substring in the string.
- Parameters:
-
sub | The substring to search |
- Returns:
- The index of the substring in the string if found, else -1
QString& get |
( |
| ) |
const [inline] |
Returns the stored value.
- Returns:
- The value
bool has |
( |
const int & |
ch | ) |
const [inline] |
Checks if character is present in the string.
- Parameters:
-
- Returns:
- True if character is present in the string, else false
string leftJustified |
( |
const int & |
w | ) |
const [inline] |
Left-justify string to specified width.
- Parameters:
-
w | Width within which to left-justify |
- Returns:
- The left-justified string
int length |
( |
| ) |
const [inline] |
Get length of the string.
- Returns:
- The string length
string mid |
( |
const int & |
start, |
|
|
const int & |
len = -1 |
|
) |
| const [inline] |
Return substring of the string.
- Parameters:
-
start | The start position of substring |
len | The length of substring, till end if -1 |
- Returns:
- The substring of the string
bool operator!= |
( |
const char * |
src | ) |
const [inline] |
Inequality comparison.
- Parameters:
-
- Returns:
- True if not equal, else false
bool operator!= |
( |
const string & |
src | ) |
const [inline] |
Inequality comparison.
- Parameters:
-
- Returns:
- True if not equal, else false
Add two strings.
- Parameters:
-
- Returns:
- New string containing concatenation of the two strings
string operator+ |
( |
const char * |
src | ) |
const [inline] |
Add two strings.
- Parameters:
-
- Returns:
- New string containing concatenation of the two strings
string& operator+= |
( |
const int & |
chr | ) |
[inline] |
Append.
- Parameters:
-
- Returns:
- Reference to self
Append.
- Parameters:
-
- Returns:
- Reference to self
string& operator+= |
( |
const char * |
src | ) |
[inline] |
Append.
- Parameters:
-
- Returns:
- Reference to self
bool operator< |
( |
const string & |
src | ) |
const [inline] |
Check if less-than.
- Parameters:
-
- Returns:
- True if less than, else false
Assignment.
- Parameters:
-
- Returns:
- Reference to self
string& operator= |
( |
const char * |
val | ) |
[inline] |
Assignment.
- Parameters:
-
- Returns:
- Reference to self
bool operator== |
( |
const string & |
src | ) |
const [inline] |
Equality comparison.
- Parameters:
-
- Returns:
- True if equal, else false
bool operator== |
( |
const char * |
src | ) |
const [inline] |
Equality comparison.
- Parameters:
-
- Returns:
- True if equal, else false
void replace |
( |
const int & |
ch, |
|
|
const int & |
with |
|
) |
| [inline] |
Replace a character with another in string.
- Parameters:
-
ch | The character to replace |
with | The character to replace with |
long toLong |
( |
| ) |
const [inline] |
Convert string to long.
- Returns:
- The long value of the string
const char* toUtf8 |
( |
char |
buf[], |
|
|
const int & |
len |
|
) |
| const [inline] |
Convert string to UTF8.
- Parameters:
-
buf | Buffer to store converted string in |
len | Length of buf |
- Returns:
- The pointer to buf
The documentation for this class was generated from the following file:
- /home/renji/Data/projects/zenlang/sources/zbl/zbl.hpp