logo

Macro Programming

logo
Contents

string Class Reference

string class More...

#include <string.h>

List of all members.


Public Member Functions

bool contains (string str)
 contain a string
int indexOf (string str, int index)
 index of
int lastIndexOf (string str, int index)
 index of
string left (int i)
 left
int length ()
 length
string mid (int i, int k=-1)
 mid of string
string setDate (string format)
 set date
string setDateTime (string format)
 set date and time
string setNum (double d, int k)
 set number
string setNum (int i)
 set number
string setTime (string format)
 set time
int size ()
 size
void toDouble ()
 convert to double
void toInt ()
 convert to integer

Detailed Description

string class

Conversion from/to int/double is done implecit.


Member Function Documentation

bool string::contains ( string  str  ) 

contain a string

Returns:
true if the string contains the string str. Otherwise false.

int string::indexOf ( string  str,
int  index 
)

index of

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

int string::lastIndexOf ( string  str,
int  index 
)

index of

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If from is -1, the search starts at the last character; if from is -2, at the next to last character and so on. Returns -1 if str is not found.

string string::left ( int  i  ) 

left

Returns:
the left i char of the string

int string::length (  ) 

length

Returns:
length of the string (same as size)

string string::mid ( int  i,
int  k = -1 
)

mid of string

Returns:
length a path of the string starting at position i with the length k. The rest of the string starting at position i is returned if k is -1 or missing.

string string::setDate ( string  format  ) 

set date

Set the string to the current date. With the string format the format can be set. Without the string the date is set to local setup.

See also:
setDateTime for possible formats

string string::setDateTime ( string  format  ) 

set date and time

Set the string to the current date and time. With the string format the format can be set. Without the string the date is set to local setup.
The format string may contain:

Expression Output
dthe day as number without a leading zero (1 to 31)
ddthe day as number with a leading zero (01 to 31)
dddthe abbreviated localized day name (e.g. 'Mon' to 'Sun').
ddddthe long localized day name (e.g. 'QtMonday' to 'QtSunday').
Mthe month as number without a leading zero (1-12)
MMthe month as number with a leading zero (01-12)
MMMthe abbreviated localized month name (e.g. 'Jan' to 'Dec').
MMMMthe long localized month name (e.g. 'January' to 'December').
yythe year as two digit number (00-99)
yyyythe year as four digit number (1752-8000)
hthe hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
hhthe hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
mthe minute without a leading zero (0 to 59)
mmthe minute with a leading zero (00 to 59)
sthe second whithout a leading zero (0 to 59)
ssthe second whith a leading zero (00 to 59)
zthe milliseconds without leading zeroes (0 to 999)
zzzthe milliseconds with leading zeroes (000 to 999)
APuse AM/PM display. AP will be replaced by either "AM" or "PM".
apuse am/pm display. ap will be replaced by either "am" or "pm".

string string::setNum ( double  d,
int  k 
)

set number

Set the string to the number d with precision of k

string string::setNum ( int  i  ) 

set number

Set the string to the number i

string string::setTime ( string  format  ) 

set time

Set the string to the current time. With the string format the format can be set. Without the string the date is set to local setup.

See also:
setDateTime for possible formats

int string::size (  ) 

size

Returns:
length of the string (same as length)

void string::toDouble (  ) 

convert to double

The string is converted to a double.

void string::toInt (  ) 

convert to integer

The string is converted to a integer.


Contents
SourceForge.net Logo