Zen
A cross-platform functional programming language

string Class Reference

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.
stringoperator= (const char *val)
 Assignment.
stringoperator= (const string &val)
 Assignment.
stringoperator+= (const int &chr)
 Append.
stringoperator+= (const string &src)
 Append.
stringoperator+= (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

Intrinsic string type.


Constructor & Destructor Documentation

string ( const char *  val) [inline]

Constructor.

Parameters:
valInitial value
string ( const QString &  val) [inline, explicit]

Constructor.

Parameters:
valInitial value

Member Function Documentation

int at ( const int &  idx) const [inline]

Return character at specified index.

Parameters:
idxThe index
Returns:
Character at specified index
int find ( const z::string sub) const [inline]

Find substring in the string.

Parameters:
subThe 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:
chThe character
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:
wWidth 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:
startThe start position of substring
lenThe length of substring, till end if -1
Returns:
The substring of the string
bool operator!= ( const char *  src) const [inline]

Inequality comparison.

Parameters:
srcOperand value
Returns:
True if not equal, else false
bool operator!= ( const string src) const [inline]

Inequality comparison.

Parameters:
srcOperand value
Returns:
True if not equal, else false
string operator+ ( const string src) const [inline]

Add two strings.

Parameters:
srcOperand value
Returns:
New string containing concatenation of the two strings
string operator+ ( const char *  src) const [inline]

Add two strings.

Parameters:
srcOperand value
Returns:
New string containing concatenation of the two strings
string& operator+= ( const int &  chr) [inline]

Append.

Parameters:
chrOperand value
Returns:
Reference to self
string& operator+= ( const string src) [inline]

Append.

Parameters:
srcOperand value
Returns:
Reference to self
string& operator+= ( const char *  src) [inline]

Append.

Parameters:
srcOperand value
Returns:
Reference to self
bool operator< ( const string src) const [inline]

Check if less-than.

Parameters:
srcOperand value
Returns:
True if less than, else false
string& operator= ( const string val) [inline]

Assignment.

Parameters:
valOperand value
Returns:
Reference to self
string& operator= ( const char *  val) [inline]

Assignment.

Parameters:
valOperand value
Returns:
Reference to self
bool operator== ( const string src) const [inline]

Equality comparison.

Parameters:
srcOperand value
Returns:
True if equal, else false
bool operator== ( const char *  src) const [inline]

Equality comparison.

Parameters:
srcOperand value
Returns:
True if equal, else false
void replace ( const int &  ch,
const int &  with 
) [inline]

Replace a character with another in string.

Parameters:
chThe character to replace
withThe 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:
bufBuffer to store converted string in
lenLength of buf
Returns:
The pointer to buf

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines